It is probably not possible to prove a causality as politics is not a natural science where experiments can be repeated.
The European Union and its predecessors implemented multiple measures, which in general reduce the likelihood of violent conflict.
One main point is to reduce hostility between the two central European powers France and Germany. Since the mid 1700s there were 5 major European conflicts involving these two powers.
- 7 Years' War (1756-1763)
- Napoleonic Wars (1813-1815)
- Franco-Prussian War (1870-1871)
- World War I (1914-1918)
- World War II (1939-1945)
The longest period of peace during this time was 55 years between 1815 and 1870.
Major causes that lead to these, but also to other wars generally are (this list is not excessive):
- Conflicts over natural resources
- Opposing Group mentality
- Autocratic leadership
How did the European Union mitigate these factors?
Conflicts over natural resources are fairly common in history. One factor in Franco-German relations was the natural resources of the Rhein-Ruhr area, which was used by Germany for military armament in World War I and World War II.
The origin of the EU lies in the European Coal and Steel Community, which lead to all member states gaining from trade in these commodities. From this grew a European free trade zone and later the European union. Bilateral trade generally leads to fewer violent conflicts between countries. There are many studies; some are here, here and here. Trade in the EU goes well beyond a simple free trade agreement.
Nationalism was a major factor in both world wars. This is also connected to the formation of opposing groups. The formation of groups leads to conflicts between these groups as a consequence of group polarization, even when the groups are formed arbitrarily. Before WWI Europe was divided between multiple allied groups (Germany-Austria, France-Britain).
The European Union basically replaced these opposing groups with one common European Group, which included the major former enemies, thereby giving the members a common goal. Furthermore it gives all member states a non-violent and regulated way to resolve conflicts and express interests between each other.
In WWI and before that most countries had autocratic leaders (Napoleon in France, Kaiser Wilhelm in Germany). Non-democratic countries have a higher probability to be involved in violent conflict than democratic countries. Furthermore, autocratic leaders before WWI were in a kind of battle for status among relatives, which they fought with military force.
The European Union encourages democratic countries. Membership in the European Union requires democratic elections, rules of law, etc. Tendencies towards autocracy in members states (as seen today in Poland) face opposition from the EU, which tries to keep members in a democratic discourse. Furthermore, countries who want to join the European Union have to adhere to the same standards, making violent conflicts with these states less likely.
Does this mean the EU caused peace?
No. Because this is not a natural science we have no control Europe to see if war had broken out without the European Union. But the EU and its predecessors established a system, whose elements generally reduce the risk of violent conflict. Additionally, a war between members of the European Union is not in sight at the moment and the period of piece of over 70 years is the longest in the last 250 years. With this information one could say that the European Union was one contributing factor to the period of piece since WWII.