It is legal for them to do this. First, if you were not pregnant, there is no doubt but they can do this: as a general matter, an employer has essentially total control over what may be brought into the work place. Since you are pregnant the employer must make "reasonable accommodations" to your medical needs, including for food or hydration. In many cases, if you had a doctor's note about your need for food or drink, they'd have to let you bring food and drink. However, a reasonable accommodation can be overridden by legitimate "business" needs, including security related. If, as is logically the case, given who you work for and what you do ("corrections nurse"), the restrictions are related to security (e.g. preventing dangerous items or contraband from coming in), they can enforce these restrictions against you.