One type, called "delayed egress magnetic locks", will not allow the door to open immediately.
If an intruder slips by the entrance controls of a building, they will not be able to exit undetected, and can be detained for questioning.
They are also used in airports and other controlled areas, where people are held until they clear customs or quarantine stations.
Pushing the emergency exit button will unlock the door, and also trigger the fire alarm.
This deters shoplifting because a person who unlocks the door in order to take an item out of the building when it is not an emergency may be reported to the police, with CCTV footage if available.