In the deepest moments of crisis, when death feels closer than ever, a shift in awareness can take place. Out of overwhelming distress and a loss of senses, a sudden memory arises, driving a person to return to their Creator and offer a prayer that crosses the boundaries of the deep. Jonah experienced a state of extreme weakness, fainting, and mental agony. The trouble was so severe that he felt tortured, bent, and completely collapsed inward, as if wrapped entirely in his own frailty [מצודת ציון, רד״ק]. This crushing despair stemmed from his belief that he would die the moment he was swallowed [רד״ק]. Alternatively, he faced genuine mortal danger from the physical pressure and severe crowding caused by the offspring inside the female fish [מלבי״ם].
Precisely from this existential distress, Jonah remembered God. This memory pushed him to pray, to repent, and to promise that he would carry out God's word and complete his mission [מלבי״ם]. The very fact that Jonah survived and remained alive inside the fish served as his proof that God had heard and accepted his prayer [רד״ק].
As for where this prayer traveled, there are two main perspectives. One approach suggests that the prayer reached heaven, which serves as God's holy dwelling [מצודת דוד, רד״ק]. Another perspective points to the physical Temple in Jerusalem. According to tradition, the fish dove into the oceanic depths directly beneath Mount Zion, the exact site of the Temple. Consequently, Jonah's prayer pierced upward from the abyss, rising directly into the holy sanctuary standing right above him [מלבי״ם].