The collapse of time was to be caused by the collapse of the Temporal Tower. An unknown force was causing the tower to collapse, which, in turn, would cause Dialga to go berserk. While time itself would collapse as a result, Dialga would be unaffected by this, causing him to rule over a dystopian Mystery World.
The collapse of time was prevented thanks to the efforts of John the Charmander and Rei the Shinx, with help from the rest of Wigglytuff's Guild, Grovyle, and others. The collapse of time never happened as a result.