Due to a transporter accident, Captain Kirk's landing party was swapped with a similar landing party from a parallel universe. This particular universe was one very similar to the one depicted in the show; with the exception that the peace-loving United Federation of Planets had been replaced with a brutal Terran Empire. The ISS Enterprise was in exactly the same place as the USS Enterprise, and was captained by a sadistic alternate version of Captain Kirk, whose first officer was a Mr. Spock with a beard.
The show ends with Kirk persuading the mirror Spock to try and forment some kind of revolution in the mirror universe. The episode is followed up in Star Trek: Deep Space Nine episodes, starting with Crossover.
See also: Spock's Beard.