How does the Alarm Stack in Starcraft II work?

The alarm cue hotkey will always move you to the latest alarm event, then cycle through the next recent alarm. Alerts will not be removed from the stack once you visit them, only after the alarm condition has passed.

Additionally, user Aequitas has some good advice on this question from 2016:

While this answer is correct, I'd advise against using this method generally. What if just as you push space, you get a different alert? Then you end up being in the wrong spot and wasting time. Set Camera Locations for important places, such as your main, nat and third. You can double tap control groups for most other regions of interest, otherwise just click on the map.

I would also recommend only using this hotkey to quickly move to a location with an alarm that you could not otherwise move to, such as in the event of an unexpected attack.