To suddenly stop being in a sad, dreamy, or distracted state and return to normal awareness.
"She had been staring at the wall for ten minutes before her friend told her to snap out of it."
Snap out of it!
— The Bangles, 'Eternal Flame' (1988) — lyric from the song