2 He said,

“I called because of my affliction to Yahweh.
He answered me.
Out of the belly of Sheol I cried.
You heard my voice. 3 For you threw me into the depths,
in the heart of the seas.
The flood was all around me.
All your waves and your billows passed over me. 4 I said, ‘I have been banished from your sight;
yet I will look again toward your holy temple.’ 5 The waters surrounded me,
even to the soul.
The deep was around me.
The weeds were wrapped around my head. 6 I went down to the bottoms of the mountains.
The earth barred me in forever:
yet have you brought up my life from the pit, Yahweh my God. 7 “When my soul fainted within me, I remembered Yahweh.
My prayer came in to you, into your holy temple. 8 Those who regard lying vanities forsake their own mercy. 9 But I will sacrifice to you with the voice of thanksgiving.
I will pay that which I have vowed.
Salvation belongs to Yahweh.”

Matthew Henry's Commentary on Jonah 2:2-9

Commentary on Jonah 2:1-9

(Read Jonah 2:1-9)

Observe when Jonah prayed. When he was in trouble, under the tokens of God's displeasure against him for sin: when we are in affliction we must pray. Being kept alive by miracle, he prayed. A sense of God's good-will to us, notwithstanding our offences, opens the lips in prayer, which were closed with the dread of wrath. Also, where he prayed; in the belly of the fish. No place is amiss for prayer. Men may shut us from communion with one another, but not from communion with God. To whom he prayed; to the Lord his God. This encourages even backsliders to return. What his prayer was. This seems to relate his experience and reflections, then and afterwards, rather than to be the form or substance of his prayer. Jonah reflects on the earnestness of his prayer, and God's readiness to hear and answer. If we would get good by our troubles, we must notice the hand of God in them. He had wickedly fled from the presence of the Lord, who might justly take his Holy Spirit from him, never to visit him more. Those only are miserable, whom God will no longer own and favour. But though he was perplexed, yet not in despair. Jonah reflects on the favour of God to him, when he sought to God, and trusted in him in his distress. He warns others, and tells them to keep close to God. Those who forsake their own duty, forsake their own mercy; those who run away from the work of their place and day, run away from the comfort of it. As far as a believer copies those who observe lying vanities, he forsakes his own mercy, and lives below his privileges. But Jonah's experience encourages others, in all ages, to trust in God, as the God of salvation.