Jonah 9

The prayer from inside the fish started with recognition that God had already saved Jonah from the sea. He talked of the prayer already answered. So we can suppose that was a prayer prayed quickly as he was thrown overboard or was desperately trying to swim in the raging waves.

Jonah 7

God is still the Lord of creation, and uses His creation in His way to fulfill His plans and purposes, in His perfect timing. It must have been very unpleasant for Jonah to be swallowed by this sea creature. But it had the effect God wanted, Jonah repented and prayed.