Loki and Svadilfari by Hardy.jpg "Loki and Svadilfari" by Dorothy Hardy
From page 222 of the book Myths of the Norsemen from the Eddas and Sagas.

How Loki Became a Mom:
The Origin of Sleipnir, Greatest of All Horses

In the early days of Asgard, after Midgard and Valhalla had been built, Thor traveled to the east to fight the Trolls while Odin wandered throughout Midgard. The other gods desired to build up Asgard's defenses against the Giants. A stonemason approached the gods to offer his services, claiming he could build a Giant-proof wall around Asgard in nine months. However, he requested an outrageous payment: the goddess Freyja, the Sun, and the Moon.

The gods of Asgard held a council. Hoping to get something for nothing, they offered a deal to the stonemason. If he succeeded in building the entire wall before the first day of summer, he would receive everything he had asked for; otherwise, he would do the work for free. The gods also insisted that he do all the work by himself without the help of anyone else. The stonemason asked that he be allowed to use his horse, and the gods reconvened to discuss it. Loki the Shapeshifter recommended they allow this exception, so the gods struck a deal with the stonemason that permitted him to use his horse.

What the gods didn't realize was that the stonemason was a Giant in disguise and that the stonemason's horse was the great horse Svadilfari, a stallion of incredible power. On the first day of winter, the stonemason and Svadilfari set to work. The gods marveled at the size of the stones the horse hauled up by night, but they couldn't renege on their deal with the stonemason. There had been too many witnesses to the deal for them to pull out of it. Adding to their worry, they knew Thor would be outraged if he returned and found a Giant loose in Asgard. So they waited and watched and worried as the wall went up around Asgard. It truly was a well-built wall, high and strong and Giant-proof, just as the stonemason promised.

Three days before the start of summer, the gods began to panic. The stonemason had almost completed the wall around Asgard and would certainly finish it in time. They held another council to discuss the problem. Everyone agreed there was no way they could just hand over Freyja to the Giants or tear apart the newly-created heaven to remove the Sun and Moon. Looking for a scapegoat, the group decided this problem must have been Loki's fault. They informed him it was now his job to find a way out of the deal or he would suffer a horrible death. Terrified, Loki swore to make the stonemason lose his wages, even if it came at great personal cost to himself.

That night as the stonemason and his stallion Svadilfari began to haul stones for their work, a beautiful mare stepped out of the woods. She whinnied at Svadilfari, apparently in heat. Svadilfari went wild, broke free of his harness, and ran after her into the woods. The stonemason chased after the horses, and the chase continued through the woods all night long. Loki's ruse worked well and the stonemason lost a day's worth of labor.

Knowing he could not finish the wall in time and had lost his reward, the stonemason fell into a Giant's rage. However, the gods had sent a message to Thor, begging him to return. Before the Giant could cause any harm, Thor arrived and bashed his head in with Mjolnir. The stonemason was dead, and to this day the wall around Asgard has never been completed.

Meanwhile and unfortunately for Loki (who was disguised as the mare), the stallion Svadilfari caught his quarry. The next year Loki gave birth to a gray foal with eight legs. He brought the foal to Odin, who named him Sleipnir. Sleipnir grew to be tall and handsome and is widely considered the greatest of all horses.

Source: This story is from chapter 42 of Gylfaginning in the Prose Edda, written in the 13th century. An English translation of Gylfaginning is freely available here: http://www.sacred-texts.com/neu/pre/pre04.htm

While on the subject of Norse Mythology, I offer these additional interesting tidbits:
1. The word for "god" in Old Norse is "ass".
2. Besides being the mother of Sleipnir, Loki is also the father of five children: a great wolf, a sea serpent, a daughter whose body is permanently half alive & half dead, and two sons who were relatively normal (until the gods got ahold of them).
3. Odin the Warrior/Wizard and Sleipnir the Greatest of All Horses provided inspiration for the characters Gandalf and Shadowfax in J.R.R. Tolkien's Lord of the Rings trilogy.

Odin rides to Hel.jpg
"Odin rides to Hel on Sleipnir" by W.G. Collingwood
From page 238 of The Elder or Poetic Edda; commonly known as Samund's Edda. Edited and translated by Olive Bray.