Allah Almighty saw the sincere repentance of Jonah and heard his invocation in the whale's stomach. Allah commanded the whale to surface and eject Jonah onto an island. The whale obeyed and swam to the farthest side of the ocean. Allah commanded it to rise towards the warm, refreshing sun and the pleasant earth.
The whale ejected Jonah onto a remote island. His body was inflamed because of the acids inside the whale's stomach. He was ill, and when the sun rose, its rays burned his inflamed body so that he was on the verge of screaming for the pain. However, he endured the pain and continued to repeat his invocation to Allah.
Almighty Allah caused a vine to grow to considerable length over him for protection. Then Allah Exalted caused Jonah to recover and forgave him. Allah told Jonah that if it had not been for his praying to Him, he would have stayed in the whale's stomach till the Day of Judgment.
Related Quran Ayaaths of this Hadith.
Surah 6 : Ayah 86 Surah 10 : Ayah 98 Surah 10 : Ayah 87 Surah 37 : Ayah 139 Surah 4 : Ayah 163"When a person dies, his works end, except for three: ongoing charity, knowledge that is benefited from, and a righteous child who prays for him."
Prophet Mohammed (PBUH)
"The best of what a man leaves behind are three: a righteous child who supplicates for him, ongoing charity the reward of which reaches him, and knowledge that is acted upon after him."
Sunan Ibn Mājah
"Every day two angels come down from Heaven and one of them says, 'O Allah! Compensate every person who spends in Your Cause,' and the other (angel) says, 'O Allah! Destroy every miser.'"
Sahih Bukhari