According to myth, Morgan Le Fay had trapped Merlin in a cave and left him frozen there for all eternity. In reality, Morgan was probably trying to protect Merlin and the weapon he had built that was capable of destroying ascended beings. The Ancients had sent Morgan to destroy Merlin's weapon, and if she hadn't done so they would have sent another. Left with no alternative, Morgan most likely destroyed the weapon and then preserved the one man capable of building another by concealing him in stasis in a forgotten cave.
Merlin's cave contained his laboratory and his research, including an Ancient repository device mounted on one of the walls. It also contained an Ancient stasis chamber, and there Merlin had slept for over a thousand years. To keep him hidden, Morgan had also set up a gate dialing system that would automatically transport Merlin to a series of planets. On each world, an obelisk stood before the stargate, and the DHD program had been deliberately altered. Every few hours the automatic dialing program would activate and the obelisk, used for localized transport, would beam the contents of Merlin's cave through the open wormhole to another world in a circuit of planets cut off from the rest of the gate system.
In their search for the Sangreal, SG-1 had been led to a planet where a holographic image of the blood-red stone stood on a pedestal before the Ancient transporter obelisk. When Daniel attempted to grasp the image, the obelisk activated, and SG-1 and Ba'al were sent to Merlin's cave, however the device had detected Adria's Ori nature, and she was left behind. The cave was on a sandy desert world, but as the gate continued to activate, they were transported to a frozen ice planet, and to a misty forest world. However the DHD could not be used to dial out unless they were able to find a way to override the automatic dialing program.
Within the cave, SG-1 found Merlin, held in suspended animation in an Ancient stasis chamber, and the plaque beside him read in Ancient, "Here lies Myrddin, Archmage of the Round." When the Ancient repository was activated, it seemed to trigger the stasis pod, and Merlin was released. As he slowly began to revive, he voiced his fear of the Ori threat, and he agreed to help rebuild his weapon. Using the Ancient repository, Merlin pieced the device together using virtual components created from base molecules, however he was too weakened to continue, and he uploaded his knowledge into the repository device for Daniel to complete the task.
Merlin died in the cave of the ice planet, and his body was left behind when the obelisk transported the team to the forest world. As Daniel struggled to complete Merlin's weapon, Carter and Ba'al worked to locate the command code in the Ancient transporter that would override the DHD dialing protocols so that they could dial out. However, Adria reached the planet first and captured Daniel and the partially completed weapon from Merlin's cave.
Episode Reference: The Quest