It was sealed with the four Pure Stones twelve years before the story's timeline. But because of the damage it caused to RaDos each time the Spell of Binding was cast, it shattered a large portion of the realm and sacrificed the Defenders' parents. As the years went by, it slowly began to break through the seal. The Defenders managed to get their hands on all four Pure Stones, but they stopped the Spell of Binding by destroying the machine for it.
They were warned previous times by Sari and Brim about just how devastating the spell was. And they didn't realize it until the Spell Zone was being torn apart and Nazmul explained it to Seth during their battle. Although it would cause the Megalith to be sealed forever, it would have completely destroyed RaDos.
The Megalith breaks free of its prison, planning to regenerate itself from the sigil energy of Arboth. During its rampage, it possessed an old woman to distract the Defenders. In the process of battling her, it separated Kragus from Seth. When they reach Arboth, the Defenders along with Adam try to keep the beast under control with everything they had.
But not even Omnikragg, freezing, or incapacitating it wouldn't work. Utilizing the power of the Warrior Henge (between Seth, Mel, Kara and Adam), the Nova Stone, and Kara's power of energy absorption, the Defenders defeated the beast, giving the sigil energy back to Rados.
Though it was at first believed that Nazmul created the Megalith, events from the episode "The Cycle" seem to indicate otherwise. Apparently, the Megalith was sealed for hundreds of years but the cycles keep getting shorter. It was the intention of the Wizards of Yan that that after several bindings, the Megalith would be forever imprisoned.
The true origins of the Megalith were revealed in "Ethos" when Alnar told the Defenders the dark creatures known as Ethos were banished and as a result, created the creature. And that his sealing was required to imprison the Ethos and the Megalith together.