The door was probably set to open going out, but not going in. This is a very common thing in hospitals. Many doors that are normally opened during the day are locked at night or on holidays, for example. This is a programmable feature in most modern building security systems.
The door will usually have a Crash Bar on the inside to get out in the event of an emergency. This is a code requirement.
Unless it is chained. I know a couple people who have been trapped in hospital stairwells all night when the exits were chained closed and the crash bars didn’t work.