Depends on the country. The Canadian government lists several special medical diets for prisoners. Food allergies is one but they list quite a bit like diets for diabetic or pregnant prisoners. For all these diets the prisoner must be diagnosed and can't simply request it because they want it.
A diet of conscience is a requested diet for religious or moral beliefs. The Charter of Rights and Freedoms requires prisoners recieve a diet that conforms to their beliefs should they be able to adequately describe and demonstrate adherence to them.
Peanuts are easy enough to eliminate from catering. Airlines don’t serve any food containing peanuts, in case there’s a passenger on board with an allergy severe enough to be set off by peanut aroma in recycled air, so if one assumes that prisons have a nominal duty of care for inmates at least to the point of not killing any accidentally, it’d follow that they also abolish peanuts from their food.
Airplanes constantly turn over the cabin air 10-15x per hour with bleed air from the engines. This then heads out the outflow valves to the exterior of the airplane.
The recirculating fans have HEPA filters on them, but the majority of air is fresh.
Even with no peanuts on board, there still can be contamination of the other foods served on board, not to mention residue from previous passengers snacks.
If they have a specific food allergy, they are given a meal that won't have that in it. Dietary and Medical keep very up-to-date lists of who can have what. Whether it's an MTI meal, Gerd, alternate protein, etc.