It is pretty clear in the Bible story that the whale swallowing Jonah wasn't meant as a punishment from God, it was God saving him from drowning. So it was actually provision to give him a second chance. The whale itself was the start of Jonah's second chance.
From Disc Two; Behind the Scenes: Jonah and the Bible (00:02:59-00:03:18) - Jonah: A VeggieTales Movie DVD (2002)