In classic Monopoly rules, a player may remain in Jail for up to three turns before being required to leave.
During those turns, the player may attempt to roll doubles. A successful doubles roll releases the player, who then moves by the number rolled. Instead, the player may use a Get Out of Jail Free card or pay the standard $50 fine before rolling and moving.
If none of those methods works during the three-turn limit, the player must pay the $50 fine and then move according to the dice roll on the third attempt. Being in Jail does not prevent a player from collecting rent, trading, or buying and selling property under the usual rules.
The limit concerns turns, not a fixed number of board laps or real-time minutes. The Just Visiting portion of the Jail space is also not a detention period; players who merely land there remain free.