In the first chapter of the book of Jonah, we are not given any hint about why the Lord had picked Jonah for the assignment. We are not given any hint that Jonah had ever sought out the Lord's attention for help or to give thanks.
Now, that Jonah's life is in danger, he finally does pray, "I called to you when I was in distress, and you answered. When I was dying, I remembered you; I prayed to you."
He appends to his prayer of gratitude a slam against false worshipers: "They forsake their true loyalty, but I will know and remember and announce by word and action that deliverance belongs to the Lord."
After his prayer, the Lord delivers Jonah from his plight. We're not sure whether Jonah's prayer was in response to things that God had done for him over and over in the past, or whether Jonah is anticipating this particular rescue, or whether the editors of the book were worried about chronology.