The Warforged formed from the remnants of military companies broken in the Third War. When Lordaeron fell, what was left of its armies fled west to Kalimdor and joined humans, night elves and dwarves in a last stand against the Burning Legion at Mount Hyjal.
When the human lines broke, soldiers from a dozen shattered companies rallied together and held the rear so others could escape. A human paladin, Andelor Reinhardt, and a night elf rogue, Harlock Arkavian, led them. They went into that battle as strangers under different banners and came out as one warband, the Warforged. Before going their separate ways, they swore an oath:
If any of us ever needs the others, the warband will answer.