The war is over. The Autobots won, and the Decepticons lost.
But that is not to say that all of the Decepticons were killed or captured. Many have escaped to the stars, Megatron among them. Optimus Prime captains but one of many ships that search known space for these escaped war criminals.
One day, Optimus caught up with Megatron. There was a battle, a space bridge accident, and now both leaders and their followers are in a strange place called Equestria. Optimus Prime easily befriends Princess Celestia and the ponies, but conspiracies from all factions threaten this alliance.