Here’s an alternative:
Equestria exists in a pocket dimension, similar to the domains in the Nevernever in The Dresden Files. Either it was primally chaotic, and Discord is its demiurge, or he succeeded in conquering it and plunging it into chaos. The ancestors of the ponies arrived–probably along with one or more humans–when a stellar conjunction occurred that made it possible to pass from Earth to the realm of Discord.
Exposure to the raw chaos of Discord either imbued the ponies with sapience, or merged them with the humans who were drawn in with them. Discord may have even done this deliberately, to make more interesting playthings. Either way, the humans (if any) disappeared before Discord was overthrown, leaving the ponies with no more than the artifacts (saddles and such) that arrived with them to support fading memories of the other world.
Over time, the ponies began to develop their own ability to manipulate the chaos around them. At first they devoted their new-won power simply to establishing havens of relative safety, then some ponies began turning it to more sophisticated uses. These new efforts did not leave the ponies unchanged, however, and it is at this point that some began manifesting horns and wings, reflecting the manner in which they wielded the chaos-power. In time, a few ponies of the greatest strength and most versatile skill even manifested both traits.
Hidden in the largest island of stability the ponies were able to maintain, they worked in secret to turn the power of chaos against itself. As Discord at last realized his peril and began marshaling his power to break their stronghold, they succeeded in forging the Elements, artifacts capable of merging disparate streams of chaotic force into a unified whole, relying on the instinctive emotional coherence of the herd to guide the streams. A single pony could, in theory, wield all of the Elements at once, provided that pony could manifest all of the necessary emotional resonances, but such lack of focus would limit the power wielded as a result. It was intended that each of the creators would wield a single Element, but that plan fell apart; in the first instants of Discord’s attack, Luna succeeded in cloaking herself, along with Celestia and the Elements, in darkness. The others fell in a doomed battle against Discord, sacrificing themselves to cover the sisters’ escape with the Elements.
Although the stronghold was broken, many fragments of the ponies’ haven endured, and pony magic began to knit them back together at once. Satisfied that he had neutralized the true threat, Discord turned to crushing each island of resistance. Taking advantage of his distraction, the sisters launched a desperate counterattack, wielding all of the Elements between them, and succeeded in petrifying Discord, binding him to the form he had chosen for the battle.
With Discord’s power contained, the ponies’ haven was quickly restored, and began to spread. The lands outside reverted to a primal state, full of Discord’s other discarded playthings, but no longer the realm of perpetual madness over which he had presided. The original stronghold was never reclaimed, however. The sisters returned to it only once, to place the Elements there in a tribute to the fallen.
Over time, the ponies’ domain expanded into the land now known as Equestria. Its borders are defined in hoofprints, a sign of the most profound and primal pony magic: that of the earth ponies. Where they walk, there is Order.
(Note: This isn’t necessarily my headcanon. It’s just me going off on one of my obsessive world-building kicks.)