In the musical les miserables, jean valjean is released from French prison in 1815 after a 19 year sentence. Shortly after release he has a brush with the law and is nearly returned to prison. He laments the close call noting that prison would mean going "back beneath the lash, upon the rack." Where French prisoners of this period actually subjected to rack torture?
While we're on the subject, could you actually get 19 years for stealing a loaf of bread at that time?
Prisoners would not be subject to torture, not legally at least. Torture had already been in decline for a century or so when Jean Valjean is released from prison. Torture became rarer and rarer during the 18th century, even if still used from time to time or for important crimes.
Torture in the legal proceedings (question préparatoire) used to obtain a confession was definitively abolished in 1780. The other torture (question préalable) used to obtain a definitive confession and all sorts of other information (such as accomplices, etc.) was abolished in 1788, both by royal decree. The 1791 Penal Code also proclaimed that no form of torture can be used against a prisoner. None of the following regimes ever legalized tortured : not the Empire, not the Restauration, not even Vichy.
That said, it does not mean than nobody in France had been tortured since 1788. The police and the military used it unofficially until quite recently. Jean Valjean should not have been subject to torture, not legally, even when he had his first prison sentence (near 1796).
Source: Entre ruse du droit et impératif humanitaire : la politique de la torture judiciaire du XIIe au XVIIIe siècle by Carine Jallamion.
I'm afraid I cannot answer about the prison sentences during the Directory or the Empire.