Story goes that in early days of Valhalla, a craftsman appeared and said he could build a wall around Valhalla in 3 seasons, and the price he would be paid would be the Goddess, Freyja's hand in marriage as well as the God Mani and the Goddess Sol. Long story short, the Gods thought this was too steep a price but given that the Jotun could invade from any direction, Loki convinced the Gods to counter the offer and pay the craftsman his price if he could complete the job in one season on the condition that no man could help him; the craftsman requested that his horse be allowed to help him;
long story short, Loki turns himself into a mare, fucks the craftsman's horse, finds out the craftsman was a Jotun the whole time and Thor cracks him in the head with Mjolnir and banishes him to niflheim then gives birth to Slephnir, Wotan's horse.