My understanding is they wanted something a little "different" that would still let the actors go shopping without attracting notice.
It's not hard to believe a paramilitary organization like Starfleet would "encourage" a given hairstyle.
Yeah, I like that they picked such a small detail for their hairdo, doesn't stand out too much, but gives all shows that small level of consistency, that I appreciate. Also the beehive hairstyle can be made somewhat reasonable, since it allows women to have long hair without it dangling down during workhours to interfere with anything... but yeah, it was just "chic" at the time, and even though it's dated from a modern point of view, it's dated in a good way.
In Star Trek, it doesn't really matter, since they don't have to wear helmets or gasmasks or anything, in settings where that is the case, certain hairdos are almost imperative to have.
the Samurai-haircut, for instance, is the logical conclusion of two things:
Long hair is a status symbol, but it gets insanely hot under a helmet, so they shaved part of their head to deal with that. I don't know where the helmet-inlay would touch the head, but depending on how it is set up, the shaved part either is directly under the inlay, meaning that the helmet is less likely to move around or the helmet inlay touched the head on the hair and thus uses the hair to add a bit of padding.

Similarly: Frankian knights.

Looks fucking stupid, but when you consider these guys would have a padded coif, maybe one layer of leather on the outside, mail armor and a helmet over their head, you can imagine how hot it gets under all that shit in the sun. Removing the hair makes it way less bulky around the neck, improving your ability to move the head and allows a bit of air on the neck, to cool down at least a little bit.
Dying of heat (either directly by heat stroke or being weakened and defeated by an enemy) was a genuinely high risk for knights and samurai alike.
Not even just a pre-modern thing. Armies forbid big bushy beards, cause that would break the seal of a gas mask, so you might get away with a moustache, since that doesn't get in the way of the ruber that keeps you alive in case of a gas attack. Short hair also makes the helmet sit more tightly on your head (and a shaved scalp reduces the risk of parasites, too).
This shit is practical as fuck cause it has to be. The soldier's life depends on it.