Speaking of fire alarms, I had another request today for a lock that ONLY unlocks to allow egress upon fire alarm. In most cases, this is not code-compliant.
There may be certain occupancy classifications (like detention and correctional) depending on which code you’re using, but other than that the only doors that come to mind are stairwell doors, elevator lobby doors in certain jurisdictions, and delayed egress locks.
A few years ago I was in a dormitory and I noticed that the stair discharge doors had mag-locks which were only unlocked on fire alarm. The university had installed the mag-locks in addition to the panic hardware, to prevent kids from sneaking alcohol into the building through the egress doors. Scary!
Typically, egress doors need to provide free egress under normal circumstances, not just during a fire alarm. For a means of egress that passes through a secure area, the options would be either an exit alarm, or delayed egress if the occupancy classification allows it.