After completing the yagya he had planned, Vishwamitra led the princes to Emperor Janaka's capital, Mithila. There, Janaka had arranged a swayamvara for his daughter, Sita. On the way, they passed through a breathtakingly beautiful but uninhabited ashram. This ashram had once been the home of Sage Gautama and his wife, Ahalya.
Indra, the king of the gods, was smitten with Ahalya's beauty. One day, while Sage Gautama was away, Indra assumed his form and made love to Ahalya. When Gautama returned, he saw Indra leaving the cottage. He instantly divined what had transpired and cursed Indra. He then turned to Ahalya and cursed her as well, transforming her into a rock. When Ahalya pleaded for forgiveness, Gautama relented and said, "You will be freed from the curse when Lord Rama touches you with his feet."
Sure enough, the moment Rama's feet touched the rock, Ahalya returned to life and bowed to him. Rama blessed her to return to her homeland and continued on his journey.