Then Jonah prayed to Yahweh, his God, out of the fish's belly.
The first threat to Jonah's life was, of course, that of drowning; and, for whatever period of time he might have been conscious inside the sea-monster, he was profoundly grateful for his being saved from drowning; and that salvation led him to believe that God would preserve him alive throughout the entire experience.  This situation explains the double application of some of the expressions in the prayer.  Critics like to complain that the passage (Jonah 2) "is not a prayer but a thanksgiving for deliverance."[1]  However, in the words of Young who refuted such statements, "Is not thanksgiving of the very essence of prayer?"[2]