The Brahmins on earth were terribly afraid and prayed to the gods to protect them. The gods entreated Vishnu for the protection of Brahmins. Vishnu told them that uniess the ocean was dried up and the Kalakeya demons were caught, nothing could be done and this task could only be performed by Agastya. Agastya could not refuse the request made by gods, therefore he miraculously drank the whole of the ocean, to the wonder of all the spectators. The gods caught hold of all the demons and killed them.
But now another problem arose for which the gods were told by Vishnu that the ocean would be filled again when Bhagirath, by his penance, would bring the Ganges on the earth. There is another version of the above episode. In order to save the world from the wrath of the demons, the gods arranged a sacrificial feast (Yajna) to which the ocean was also invited, but he did not come because of his ego, therefore Agastya drank him. When the beings of the sea began to writhe in agony, because of the want of wate
When the ocean was churned by the gods and demons jointly, fourteen precious gems (Chaudeh Ratan) came out of it. They included the ambrosia, moon, elysian cow, Lakshmi, the miraculous tree, the sun\’s steed and the physician Dhanantar. But still the water of the ocean could not become sweet and remained saltish because of his past Karmas.
References :
1. Kohli, Surindar Singh, Dictionary of Mythological References in Guru Granth Sahib, 1993