Agastya was a venerable and powerful sage. Once, when he was in heaven, he saw his deceased ancestors suspended with their head downwards. Agastya was surprised because this was a sign that they were preparing to go to hell. Agastya asked them what wrong had they committed. They told him that it was Agastya's fault that they would go to hell. Agastya did not have a son; in fact he was not even married. Hence the lineage would end with him. Then there would be no one to offer prayers on their behalf and they, Agastya included, would go to hell.
He assured his ancestors that he would do the needful. But the task was easier said than done because there was no woman on earth worthy of his qualities and stature. Hence he created a woman by taking those parts that were regarded as highly beautiful, from creatures possessing them and joining them with his ascetic powers. At that time the king of Vidarbh was undergoing austerities in order to obtain an offspring. With the greatness of spirit that he was known for, Agastya decided to gift this child to the king. Accordingly he reduced her to a seed and had it implanted in the queen's womb. In due time, a girl was born to the queen. She was given the name Lopamudra.
Lopamudra grew up to be not only a very beautiful maiden but extremely well-mannered as well. At the appropriate time, Agastya asked for her hand in marriage. The king was in a quandary. If he agreed he was sending his daughter to the harsh life of an ascetic and if he refused he could suffer the consequences of the sage's wrath. Lopamudra played the role of a dutiful daughter and convinced her father to give her away to Agastya.
After the marriage she cast away her royal garments and shared her husband's life style completely and without complaining. Once when Agastya saw Lopamudra coming out of her bath he realized that he had yet to consummate their marriage. After all, the whole train of events had begun with his requirement of a son. When he summoned Lopamudra for this purpose she put forth a condition. She said, "In all your work as a hermit I am participating as a hermit's wife. But in matters of love I will need to be treated as a princess. I will accept you only on a bed like I had at the palace and clad only with the ornaments befitting my former royal status." Agastya argued that he was in no position to afford the luxuries she spoke off. Then Lopamudra advised him to exchange the wealth of his knowledge and powers for some material wealth.
Agastya approached king Srutarvan for assistance. The king was more than willing to help, but Agastya in his greatness had put an unusual condition. He had insisted that the king should not give him wealth by depriving any other person of assistance. When the king demonstrated the equality of his income and expenditure (which included substantial charity) Agastya refused to take any assistance. Srutarvan then took Agastya to a greater king, Vradhnaswa, but the same story was repeated there. Then the three of them went to king Trasadasyu, but with the same outcome. Trasadasyu explained that only a Demon king would be able to meet Agastya's requirement because he gave no wealth in charity but accumulated it. Accordingly they went to the Demon king Ilwala.
Ilwala had a younger brother named Vatapi, who had developed a very unusual power. He could transform himself into any creature. Then the creature could be cut up into any number of pieces and strewn about. When Ilwala summoned, the pieces would join together with great force to reform the creature. The Demon brothers used this technique to destroy brahmins. Vatapi would transform himself into a ram. His flesh would then be cooked and given to brahmins to eat, flavoured and disguised as a vegetarian dish. After the brahmins had eaten their fill, Ilwala would summon his brother and the pieces of the ram would burst through the stomachs of the brahmins, killing them.
When the three kings and Agastya arrived at Ilwala's court, the king decided to use the ram technique to kill them. After due courtesies dishes containing the ram were served to the guests. Agastya, however, ate all the dishes himself. Then Ilwala summoned his brother but all that happened was a loud belch by the sage. Ilwala kept on repeating his command, but to no avail. Agastya laughed and said, "He cannot come out now. I have completely digested him." Because of this incident, if a person has very good digestion powers he is jokingly referred as sage Agastya. And if one has bad digestion then the sage is jokingly invoked to cure him.
Though Ilwala was saddened at the death of his brother he asked the sage of what service could he be? Agastya repeated his request and condition. Ilwala then gave the sage more than he needed. In addition he gave a golden chariot and two super-fast steeds so that that Agastya would reach his hermitage in a flash. At the hermitage Agastya gave the excess wealth to the tree kings and thanked them for their time and company.
With the wealth obtained from Ilwala, Agastya was able to satisfy all of Lopamudra's conditions. As they came together on the special bed Lopamudra asked for a son endowed with great energy. Agastya put some options before her. He asked, "Would you like a thousand sons; or a hundred who are ten times as powerful as the first; or ten who are hundred times as powerful as the first; or one son who is a thousand times as powerful as the first?" Lopamudra opted for the last option. After Lopamudra conceived the sage went to the forest. Lopamudra bore the embryo for seven years and all this time the sage meditated. At the end of seven years a resplendent son was born. They named him Dridhasyu.
Now the ancestors of Agastya no longer had to hang upside down but obtained the regions of heaven they desired.