One of the great issues with temporal mechanics is that of paradoxes. By far the most famous of these is the so called "grandfather paradox". This occurs when a time traveler kills their own grandfather, therefore preventing the birth of one of their parents and ultimately of themselves. Since the time traveler was never born, then they cannot have traveled back in time to kill their grandfather. Yet if their grandfather is not killed, then the time traveler is indeed born and can then perform the murder successfully. And so on.
The theory of parallel dimensions originated in the 20th century as a way to explain such paradoxes. Briefly, the theory proposed that each time an event occurred a number of new universes was created in which every possible consequence of the decision was played out. So when the time traveler kills their grandfather it does not in fact erase themselves from history, because two universes are created - the original one in which the grandfather lives and a new one in which he does not. Since the time traveler originated in the first universe, then he can continue to play out the consequences of his or her actions in the second.
Since there are a near-infinite number of possible actions and consequences then the number of parallel universes is also near-infinite. Many would be only marginally different from our own - universes in which a single relatively unimportant action occurred in a slightly different manner and had little or no overall effect. Others would be radically different.
For centuries this theory remained just that, but in 2267 Captain Kirk provided proof of the actual existence of parallel universes. The Enterprise encountered Lazarus, a man who had become obsessed with finding and killing his counterpart from a parallel universe composed of antimatter. He was ultimately unsuccessful, but both he and his counterpart became stranded forever in an interface between the two dimensions.
Later in the same year came a much more wide-ranging contact between parallel universes. Whilst beaming up from the Halkan home world during an Ion storm, Kirk and several of his officers were swapped with their counterparts from an alternate dimension. Kirk found himself on an Enterprise which was a ship of the Terran Empire, a disturbing mirror image of the Federation. The Empire was a violent and expansionist power dedicated to the enslavement of other life forms. In this dimension Humans had no general philosophy of self-improvement, kindness or compassion. Rather Humanity became dedicated to greed, violence and the survival of the fittest - or rather, of the most ruthless. On board the Enterprise discipline was enforced by 'agonizers', pain-giving devices that each person was forced to wear. Career advancement through the assassination of superiors was commonplace, and all senior officers walking the ship would be accompanied by a bodyguard detachment.
In later eras further crossovers have occurred, both into the same Mirror universe Kirk visited and others. The crew of Deep Space Nine have had several encounters with the Mirror universe, finding that the Terran Empire had collapsed and been taken over by a Cardassian/Klingon alliance. A handful of Terrans have been fighting back against the alliance with the assistance of the Federation crew.
In 2370 Lieutenant Worf of the Enterprise-D passed through an anomaly which caused him to begin jumping between parallel dimensions. When the Enterprise attempted to investigate the phenomenon, an attack on the ship caused an accidental rupture in the quantum barrier which keeps the universes separate. As a result, hundreds of thousands of different versions of the Enterprise were brought together into a single universe. Fortunately the barrier was repaired and everything returned to normal.
This information is courtesy of the Daystrom Institute Technical Library and copyright Graham Kennedy.
The U.S.S. Enterprise NCC-1701-D was swapped over into a closely neighboring parallel universe by an Imperialistic United Empire of Planets, which was ruled by fear. The Starfleet of this Empire had exploited the entire Milky Way galaxy to the point that it had nowhere else to go. The Empire had done work concerning interuniversal swapping into parallel universes, culminating in their development of an interuniversal swapping device. The Imperial Empire had completed reconnaissance work in our home universe, followed by the swapping over of one of our starships into the Empire's home universe. The Empire's intentions were to take over the Federation ship then swap it back over into the Federation universe and learn as much as they could about our Starfleet and about our home universe.