It is a device used to notify the fire department. Some see them as outdated since everyone uses a cell phone these days. However in case of a disaster, power might be out, phone services might be broken and then such alarm box is quite useful.
Interestingly enough such boxes don't seem to be in every city of the US. I just found a online list of cities with operating box alarm systems. The list is not that long and San Francisco is one of them.