Ahalya was created by Lord Brahma. She was extremely beautiful and without any blemish. Brahma wondered to whom Ahalya should be given away as a bride. The story of Sage Gautama and Indra competing to marry Ahalya begins at this juncture.
Both Indra and Sage Gautama wanted to marry the heavenly beauty. Both were not ready to sacrifice.
Brahma then declared that he who went around the earth first would be the winner.
Indra started on his Airavata (white elephant). But the wise and intelligent Gautama circumambulated a cow that was giving birth to a calf.
According to scriptures, he had accomplished the task of going around the world in less than minute.
Indra soon completed the task but realized that Sage Gautama had won the hand of Ahalya in marriage by beating him in the race.
Indra kept the grouse and later he cheated the sage later and made love to Ahalya.