Mezuzah in prison – Ask the Rabbi
Q. Is a mezuzah needed on a caravan, a market stall or a prison cell?
A. The Shema requires a mezuzah “on the doorposts of your house and on your gates”.
The criterion is whether a particular place is a dirah – a dwelling. If the area is about 8 square feet and one eats there, it needs a mezuzah.
Thus a car does not need a mezuzah but a caravan does. A temporary market stall does not need one (even if you eat there) but a permanent shop or office does (Yoreh De’ah 286).
Rabbi Chayyim Joseph David Azulay says on Yoreh De’ah 286 that a prison cell needs a mezuzah if the inmate has been sentenced to a longish term, but not if it is only for a few days.
Obviously no-one regards prison as a permanent dwelling!