Sleipnir is Odin’s eight-legged horse and is the bestest of all the Aesir’s horses. Apparently, Sleipnir’s story of how he came to be begins with when the gods had just established Midgard and a builder came to offer to construct a mighty fortification that would keep out the pesky giants. For payment, he wanted Freyia for his wife, and the sun and moon, too. The gods agreed, but with the stipulation that he would build the fortification in one winter, and that no man would help him with the construction. It being negotiated that he would only receive help from his mighty stallion, Svaldifaeri, the builder set to work. This last bit, however, was only granted by Loki.
So, when the builder’s work was nearly complete within the same winter, the gods then frowned and didn’t like that they’d have to send Freyia off to giantland (apparently the builder was a giant), not to mention the sun and moon. Since it was Loki who allowed him the help of his horse, it was decided that Loki would be the one to fix it. So, Loki turns himself into a lovely mare and catches the eye of Svaldifaeri. They run off together, leaving the builder in the lurch.
Now, I don’t think the gods knew for certain that this builder was a giant, and so I think this whole charade was an attempt to get him to show his hand. When it looked like he wasn’t going to finish the fortification in time, the builder went into a rage, showing himself to be the giantfolk he was thus nullifying all oaths that had been given. So the gods called on Thor (who was off bashing up some trolls) and he came and thwacked the builder in the head and killed him.
What does any of this have to do with Sleipnir? Well, apparently, Loki had “had such dealings with Svaldifaeri” (Sturluson p. 36) and later gave birth to a grey foal with eight legs.
And that, as they say, was that.
Sources: Sturluson, Snorri, Edda, Everyman, 1995. Translated and edited by Anthony Faulkes.