What would happen if all countries suddenly stopped using local currencies and adopted a global currency (like the Euro, but for everyone)?
The Euro was always conceived by most Economists as a political goal, not an economic one.
Prologue: There is the theory of Optimum Currency Areas (OCA) which characterizes properties that a larger area would need to have if it were to operate on a single unit of currency. Since the announcement of the Euro around 1990, there were many papers that looked into whether the European Area actually satisfied the broader range of these criteria, and they mostly agreed that it did not.
Ex-post, we can now see this playing out as the ECB has a hard time setting up an inflation rate that is improving conditions of countries that are hit very badly by the crisis such as Greece and Spain, and countries which are not, such as France and Germany.
Intuition behind OCA
Basically, a country gives up the tool of monetary policy when it subordinates into such a currency union. In order to properly use monetary policy for a set of different economies (countries), you need these to be very similar in nature: If all countries react similarly to a housing bubble / oil shock / etc, you can easily improve outcomes for all countries with the same monetary tool. If the countries respond differently, it is much harder to do so.
Single currency for non-OCA
To the extent that all countries in the world are very different in nature, your experiment is similar to the gold standard (see Bretton Woods system). We think about that system mostly as a failure. While there is no hard data on the causal relationship, countries that abandoned the gold standard earlier tended to do better. We observed similar trends for countries that abandoned the dollar standard earlier. As a short intuition, among other explanations, when you abandon monetary policy and fix your exchange rate, you make yourself more vulnerable to inflation/deflation of other regions.
After a period of time they would switch back.
The monetary systems of each country are based on fractional reserve banking, which creates a leveraged relationship between currency and deposits within the banking system. Both forms of money are used interchangeably for purchases, although in practice the use of bank deposits dominates in modern systems.
The underlying problem posed by a single currency is that for a variety of reasons, every single country is expanding their bank deposits at different rates. In floating regimes, currency exchange values change over time to adjust for this, but in a single currency regime this can't happen. As a consequence goods become relatively more expensive in countries whose banking systems are expanding quickly, and less expensive in those which aren't - without this necessarily reflecting any underlying economic realities vis-à-vis production. Eventually (over decades - it's a slow system) the discrepancies become so extreme, that economic reality in the form of arbitrage intervenes in a way that invariably causes the destruction of the currency union.
Examples of this process can currently be seen in the Euro zone, it is left as an exercise for the reader to work out which countries are expanding faster than others.