Academy graduates, upon receiving their first assignments, are typically issued three things: Their uniform, their communicator, and their phaser. The bright-eyed young recruits then blast off into space, in search of adventure! If, however, your uniform is of the security / ops variety, you’re a member of the infamous “redshirts.” As such, you’re also given one extra item.
The Official Starfleet Hip Flask. Why? Because your job is going to be hard. Whether you’re having to deal with a tyrannical captain who demands you give him “warp speed NOW, mister” or you’re expected to act as cannon fodder for the next away mission, there will be times when a quick belt is what you need to get through the day.
Maybe you’ll be assigned to engineering. Sounds like a nice job, doesn’t it? Playing around with plasma manifolds and adjusting the polarity on a stuck phase inverter sounds like interesting work. Then, one day, the captain orders you to disconnect the hyper-intelligent battle-computer from the warp engines and VOOM! You’ve been vaporized into a reddish mist.
Perhaps, instead, you’re assigned to security. Sounds idyllic – beaming down to some pastoral world, verdant and clean without even so much as an insect to bother. One step around a boulder and SHAZAM you’re reduced to a pile of ash and smoking boots.
It’s enough to drive a man to drink, and Starfleet is a pragmatic organization. Rather than combat drunkenness at work, they encourage the redshirts to “take the edge off” their days. It’s the least they can do, considering your inevitable sacrifice.