To protect his Pokemon from harm Arceus has moved most of his worlds populus to Equestria in hopes that they can live in peace, but peace is often harder to obtain than one might think.
"Twilight, I'm glad that you handled Prince Rutherford's declaration of war without violence, but he should have never been given the chance to make that threat."
Optimus Prime ends up arriving in Equestria during his travels after Age of Extinction. And finds out that the ponies who live there are more than meets the eye.