This part is taken from Various Stories & Tales in “Spiritual Stories” as Told by Ramana Maharshi

Indra approched ahalya  (wife of Gautama) taking the form of Gautama and she yielded without knowing that he was not her husband. Without ascertaining the truth, Gautama cursed her to become a stone. Angered thereby Ahalya said, “Oh, you fool of a Muni! Without enquiring into the truth, you have cursed me and have not even stated when I shall be free from the curse. Tell me, when will the curse end and how? Why not have some consideration for me and tell me at least that?” Gautama thereupon told her that she would be released from the curse at the time of Rama avatar when the dust from Rama’s feet fell on her. Immediately thereafter she became a stone.

Gautama left that place and tried to get into his daily rituals but he could not, for he had no peace of mind. He tried his level best but could not control his mind and became more and more troubled. On thinking deeply over the matter, he realised that he had cursed his wife Ahalya without proper enquiry and also recollected that she had in turn cursed him by saying, “You fool of a Muni!” After all, she was also a great tapasvini (a female ascetic). Hence those words which were unusual must have resulted in an irrevocable curse on himself. He therefore decided to seek the help of Iswara, by seeing his “Nataraja Dance”, in order to get relieved of the curse.

He therefore went to Chidambaram. At that place he heard an ethereal voice saying, “I shall be pleased to give you darsan of my Thandava dance in Trisulapura.” Gautama immediately left that place and went on foot towards Trisulapura. On nearing the place, and at the mere sight of it, even from a distance, his mind began to get clear. He stayed there for a very long time doing tapas. At last Iswara was pleased and gave him darsan of his “Nataraja Dance” in the month of Dhanus when the Ardra star was predominant. It was at that time Gautama is reported to have lived under the tree and performed tapas. After seeing the dance of Iswara, Gautama worshipped Iswara, went to his original place and began to perform his rituals as usual.

Later on Ahalya became purified by the dust of the feet of Sri Rama and regained her normal form.

Devotee: “The statement that Ahalya turned into a stone applies only to her mind and not to her body. Is that not so?”

Bhagavan: “That is so. If it is not for the mind, could it be for the body? It is only ordinary people that say her body turned into a stone and that Rama restored her to her original form by putting his foot on the stone. How is that possible? It only means that the mind lost its awareness of the Self, and unable to think of anything else, she became dull like a stone. That dullness got relieved by the darsan of a great personage. As she herself was a great tapasvini she could immediately become aware of the Self. She worshipped Sri Rama as the embodiment of the Self. This inner meaning could be found in the Ramayana. The moment Rama set his foot in Gautamasrama, the mind of Ahalya was restored to its original state, like the blossoming of a flower.”