It's obvious that having short or long hair is an identity sign for men and women respectively, more or less worldwide.
No, it's not obvious, especially not in history.
You may be mistaking a Western, Roman Catholic, modern behavior for something universal.
The Romans were a little strange in their belief that men should shave and wear their hair short(ish). They bequeathed this to the Roman Catholic Church, which then constantly tried to impose it on European culture. This was passed down to the Protestant churches, mostly rather puritanical, who felt that long hair on a man was Vanity when he should be working as hard as possible to be ugly and practical. From there it reaches the Victorians, who additionally were obsessed with making women a different creation, and finding or creating as many differences as possible between the two sexes (women, you see, by nature breathe thoracically, while men breathe abdominally -- a difference only found when women wear corsets and men don't, but touted by medicos of the time as part of the basic anatomy of the sexes).
This is about the level of "natural" in men having shorter hair. Nature, in fact, teaches us that a man and his sister will grow hair about the same length, shaft thickness, and mass. That she averages 4" shorter results in her hair seeming just a trifle longer. But women don't somehow magically grow much longer hair.
What you need to consider in nature is that humans are totally weird in being near-naked over the rest of the body but having this very long mane on top of the head (and men, on their faces).
Elaine Morgan, in The Descent of Woman, points out the theories of other scientists deriving a number of human traits, starting with the diving reflex, to a time when our pre-human ancestors seem to have lived on the beach and considered going marine mammal, as the elephants nearly did, too. This adaptation shows in the streamlining of hair on the body, or its near loss (the adaptation is more advanced in women), while developing the head of hair as tow ropes for infants. Anyone with long hair who has had a little baby clamp on knows how strongly they can grip it, and with a look of pure delight: I think it makes them feel happy and secure.
Male pattern baldness is irrelevant to this. Even as a man is thinning on top, or totally chrome-domed, he can grow the rest quite long enough to tow a child by. (Note: it affects about 70% of men and 40% of women by the time they are old.)
The average head hair grows 1/2" a month, and lives about 3 years, giving a max length of 18". People with knee-length hair grow it faster and their follicles hang in there longer. Until my later 40s, my hair grew 1" a month, but only lived about 2-2.5 years. As a result, I could grow it sittable, but not longer, but it was all very healthy and bouncy, because none of it had much wear and tear. Ill health will always result in nails and hair growing more slowly and the product being more fragile.
In most periods, anyone with hair over their shoulders had it "long." Braids that hung down onto the bosom were notably long hair of the femme fatale in Burnt Njal's Saga. I have met women with knee-length hair, or longer (most men will cut it shorter), but when you see it as a fashion, as in the 12th C, you can bet the braids are fake. Very few people can grow it this long. (This always reminds me of the mid Victorian fashion for piling up so much attached hair that it was larger than the wearer's head.)
Hair length, texture, and mass are all hereditary. People ask me how to get a thick head of long hair, and I tell them, "Choose your ancestors carefully."
More averages: among Europoids, the thickest number of hairs per area is usually found in brunets, followed by redheads, with blonds having the least. That's relative. East Asians tend to have coarse hair, more spaced, that gets thinner with age, so that if they wear it short you can see a lot of scalp. Older Asian women often get nearly as thin as their brothers, which is very visible if they insist on wearing Western-style short hair. The use of equine mane and tail shampoos has become popular in Japan and China because of their hair texture: most people shampoos are aimed at European hair.
Women's hair usually reaches maximum thickness during their first pregnancy. It's shocking how much comes out in the brush after the baby is born. There's another thinning at menopause, from hormonal shifts.
Brunette women with really thick manes are often fighting sideburns and light mustaches, I might point out. It's not the most feminine trait.
It's almost always men who have the half-inch long thick eyelashes, too. What's often marked as desirable is not what's common to the sex, but what's rare.
We'll take this in all cases as "before Westernization." Also, assume women are wearing hair pretty long unless otherwise noted.
That long beards and hair were somehow dangerous in battle seems to have influenced no one at all. Some of the most notable warrior cultures wore long hair.
In East Asia, both sexes customarily wore long hair in most societies. Male and female Sikhs must wear it uncut, for their religion.
In the basins of the Orinoco and Amazon, it is usual for men and women both to wear short hair. On the Great Plains, the Sioux and the Cheyenne, in both sexes wear hair in long braids.
Steppe tribes, men of the Scythians, Sauromatians, Sarmatians, Sakas, &c, wore long hair, with or without mustaches or beards. (https://en.wikipedia.org/wiki/Scythians#/media/File:Scythian_Warriors.jpg) They often bundled it up at the back of the head. Women were differentiated by matrons wearing tall tarbooshes, one sign by which they should have known that the Golden Prince burial was actually a Golden Princess (weapons and all).
The ancient Egyptians in both sexes cropped the hair very short, and women wore cloth headdresses or wigs, as men might also. (https://en.wikipedia.org/wiki/Wig#/media/File:Egypte_louvre_286_couple.jpg)
The ancient Minoan men wore their hair very long. (https://en.wikipedia.org/wiki/Prince_of_the_Lilies#/media/File:Feather_prince.jpg)
You can always spot a Spartan in art by his long locks (I refuse to see 300 as being obvious modern machismo nonsense) and lack of mustache, though wearing a beard. A Spartan bride cut her hair very short the day of her wedding. We aren't certain they didn't keep it short as a mark of matronhood. Xenophon notes that they felt long hair made a handsome man more beautiful and an ugly one more fearsome. (http://035fe62.netsolhost.com/t.d/1917.jpg) Archaic Greek statues show men with very long hair.
Other Greeks are usually shown in Classical art as having shortish hair and a beard. Slaves, on the other hand, were required to have their heads shaved regularly, and their beards at the same time. It was unmanning them. Also, you knew anyone shaven was a slave, and not a free man. Slave women usually had shortish hair.
Persians and Medes also wore collar-length hair and beards, but are shown with them very carefully curled. (https://en.wikipedia.org/wiki/Darius_I#/media/File:Darius_In_Parse.JPG) This is pretty much the Mesopotamian fashion after the Sumerians. Thing is, the ladies appear to have worn their hair the same. (https://en.wikipedia.org/wiki/Achaemenid_Empire#/media/File:Iranian_queen.jpg)
As it happens, I was just reading The Anglo-Saxon Home: A History of the Domestic Institutions and Customs of England from the Fifth to the Eleventh Century by John Thrupp.
"Long and flowing hair was, at first, evidence that the wearer was a noble, and always, that he possessed, unforfeited and unimpeached, all the rights of an Anglo-Saxon freeman. It conferred dignity on the wearer; and the highest and most illustrious were proud of it. It was the distinction in which the Merovingian kings of France most gloried; and Harold Fair-hair and Cnut the Great considered that the length and beauty of their hair added to their lawful claims to popular admiration."
Shaven heads and short growth were both marks of the slave, the criminal, and the outlaw.
In the early period, Saxon maidens wore their hair long, and cut it short on their wedding day, and kept it that way. Later, it was worn trimmed and bound up on marriage.
Long hair comes and goes as a European male fashion throughout the Middle Ages and Renaissance.
From 1624, Louis XIII supported the use of the peruke or male wig, worn very long, because his hair no longer looked so hot worn naturally this way, as he was greying and balding. This led to an exaggeration of length and curliness and mass in male hairstyles under his son, Louis XIV. Charles II brought this style to England, as the periwig. So while men actually had their hair quite short, wearing a cap to bed or for lounging, the fashion or look was that of a huge mane not equaled even in the 1980s hair bands. (https://en.wikipedia.org/wiki/Hairstyle#/media/File:George_I_Elector_of_Hanover.jpg) (https://en.wikipedia.org/wiki/Wig#/media/File:Ex-voto_a_sainte-genevieve_-Detail-Largilliere.jpg)
In the 1700s, powdering the wig became popular. Then men began wearing their own hair long in wig-like styles, powdered or not, which resulted in much more realistic-looking styles we know from the American Revolution. In the 1790s both wigs and powder were out of fashion. Benjamin Franklin is usually shown with long hair loose. (https://en.wikipedia.org/wiki/Benjamin_Franklin#/media/File:BenFranklinDuplessis.jpg)
In the 1790s, men began to sometimes choose short hair, but so did women, in the fashions of the Directoire.
In the early 1800s, Beau Brummell wore his hair quite long, so we know it was fashionable, though shorter hair was coming in. (https://en.wikipedia.org/wiki/Beau_Brummell#/media/File:BrummellEngrvFrmMiniature.jpg)
However, Brummell himself converted to collar-length hair, to accomodate the proper crisp cravat and curved collar he came to favor. After this, while some men wear long hair (especially where barbers may be few and far between), it is not fashionable again in the West until the late 1960s.
(Then just add Semaphore's great answer)
Do note that by the 20th C women are cutting their hair short, so that the "boyish bob" again put the genders about equal on hair length. You can call the 20th C "The Age of the Beauty Shop," when women had to go in monthly or so to get their hair cut again (and permed/dyed/relaxed) because short hair was now the norm for women. Women who wore it long (shoulder-length) and loose were considered either too youthful or too sexy: it really wasn't "proper" for clubwomen and matrons.
The Costumer's Manifesto is always a good quick check for In/Out for an era (http://www.thecostumersmanifesto.com/index.php/Costume_History)
Boucher, 20,000 Years of Fashion (good for very early dress -- like, Neolithic)
Gernsheim, Victorian and Edwardian Fashion: A Photographic Survey
Gorsline, What People Wore: A Visual History of Dress from Ancient Times to 20th Century America (notable for covering American West)
Hill & Bucknell, * The Evolution of Fashion: Pattern and Cut from 1066 to 1930*
Houston & Hornblower, Ancient Egyptian, Assyrian, and Persian Costumes and Decorations
Houston, Medieval Costume in England and France, The 13th, 14th and 15th Centuries
Morgan, The Descent of Woman
Price, Dame fashion: Paris - London, 1786-1912
Thrupp, The Anglo-Saxon Home: A History of the Domestic Institutions and Customs of England from the Fifth to the Eleventh Century
Waugh, The Cut of Men's Clothes 1600-1900