Jonah 2:1 Jonah prayed to the LORD his God from the stomach of the fish.
It's not exactly a closet, but at least its private.
It seems from this passage that Jonah could not swim. He continually talks of his distress, but this distress is not being swallowed by a fish but that of drowning.
Jonah 2:5-6 Seaweed was wrapped around my head. I went down to the very bottoms of the mountains;
It is in the despair of drowning that he calls out to God. It is interesting that there is no confession. Even still, it is never a good idea to make too much out of the absence of any expected device in a story, although it can make for a great sermon. "What are the three things Jonah, the lazy prophet, didn't do in the whale? Confess his sin, raise his hands when he prayed, give his tithe. Since we don't want to be like Jonah we should do these things." In a certain way Jonah confessed his sin before the sailors in the previous chapter and accepted responsibility for that sin by being cast overboard. A dangerous proposition for a man who apparently couldn't swim.
My favorite verse is 7
When my life was ebbing away, I called out to the LORD, and my prayer came to your holy temple.
On the brink of suffocation he called out to God. I wonder what kind of hope a man can have when he has sunk like a rock to the bottom of the ocean? Is true faith acting here, or desperation? Is there any difference when one cries out to God for mercy?
In God's mercy he heard Jonah's prayer all the way from the temple. Not even Solomon believed that God lived in the temple, but it is normal for an OT believer to address his prayers to God either in the temple or toward the temple (or toward the Holy City when the temple was destroyed). On one hand they believed that God is everywhere and at the same time they saw that he gave special attention to those who prayed in/toward his temple. Considering that God has taken up residence in us (he has tabernacled in us) that gives us special privilege to appeal to God on our own behalf and for others.
The Lord answered Jonah by having him swallowed by a fish. Salvation belongs to our God, but it is not always pretty.