Jonah was not in the fish’s belly "forever" Jonah 2:6.
That verse doesn't mention the whale at all but the word for "for ever" can mean less than forever by definition.
H5769
עלם / עולם
‛ôlâm
BDB Definition:
1) long duration, antiquity, futurity, for ever, ever, everlasting, evermore, perpetual, old, ancient, world
1a) ancient time, long time (of past)
1b) (of future)
1b1) for ever, always
1b2) continuous existence, perpetual
1b3) everlasting, indefinite or unending future, eternity
Part of Speech: noun masculine
A Related Word by BDB/Strong’s Number: from H5956
Same Word by TWOT Number: 1631a
So, it can mean many many different things including forever, or a long duration etc.
This is another way how Hebrew expresses something literally lasting forever:
Exo 15:18 The LORD shall reign for ever and ever.
Here ‛ôlâm is combined with ‛ad and ‛ad means forever, no ending.
H5703
עד
‛ad
BDB Definition:
1) perpetuity, for ever, continuing future
1a) ancient (of past time)
1b) for ever (of future time)
1b1) of continuous existence
1c) for ever (of God’s existence)
Part of Speech: noun masculine
A Related Word by BDB/Strong’s Number: from H5710
Same Word by TWOT Number: 1565a