The Aztecs and Incas, for example, never allowed women to go into war. This was also the case for China, the ancient Middle East and North Africa, Europe, Southeast Asia, and sub-Saharan Africa. I'm confused. Why would women across the globe not be allowed to fight in war?
The usual four reasons given for the majority of soldiers being men (today, in addition to ancient and medieval times) are that men are (a) bigger and stronger on average, (b) more aggressive on average, through training and/or hormones, (c) more expendable, and (d) it's their traditional role. But this says nothing about "Why weren't women allowed to fight?"
Why weren't women allowed to fight?
In many cases, they were. Documentation is poor - contemporary sources tend to be brief, and focus on the deeds of the high and mighty. Commanders receive far more attention than the common soldiers. When the bulk of the army is almost invisible, women among them are invisible. Women commanders are mentioned (e.g., in sub-Saharan Africa, India, SE Asia, the Middle East, China, Central Asia, Europe), but often it isn't clear whether they would have ever fought personally. Some individual women are named as warriors (often as great warriors), but often their stories are more folklore than history. Where folklore and/or history and archaeology come together and all say in unison that some women fought in wars, we can be confident that some women fought in wars. At times, archaeology suggests that women did so often (although still less often than men).
One notable European example is Viking women. Warrior women appear in the sagas, and also in history. For example, the Byzantine historian John Skylitzes reported that warrior women were among the enemy dead when an attacking Rus army was defeated in the 10th century, and where folklore and history meet, Saxo Grammaticus described the involvement of warrior women in the 8th century Battle of Brávellir (an almost certainly exaggerated 300 hundred of them, 3 of whom he named - 300 might seem many, but they only made up 0.15% of army supposedly 200,000 strong (certainly exaggerated!)). Archaeology supports the existence of Viking warrior women, with female skeletons buried in the same manner as male warriors, with weapons and sometimes sacrificed horses. For example, the Solør warrior woman was buried with a sacrificed horse, sword, spear, axe, shield, and arrows. The Birka warrior woman (grave Bj.581) was buried with 2 horses, sword, spear, axe, war knife, 2 shields, and arrows. It is often argued that burial with weapons like this is only an indication of high status, rather than warriorhood (the same is rarely argued for male burials). However, it should be noted that the Solør woman had a head wound from a sword. Also, the archaeological evidence is not considered in isolation, but together with history and folklore which support the existence of warrior women.
Most other European cases of women in battle are women as leaders, often commanding the defending side in a siege. Whether or not they should be considered "warriors" is usually unclear. However, some women certainly merit the term "warrior": Joan of Arc was wounded in battle more than once, Anna Komnene's Alexiad noted Gaita (AKA Sikelgaita), wife of Robert Guiscard, Duke of Apulia, who both commanded troops in battle, and fought as an armoured cavalrywoman, including in close combat, and historian Orderic Vitalis reported of the 11th century Isabel of Conches, wife of Ralph of Tosny and Helwise, that "she rode armed as a knight among the knights; and she showed no less courage among the knights in hauberks and sergeants-at-arms than did the maid Camilla, the pride of Italy, among the troops of Turnus." Women were sometimes mobilised on a larger scale in emergencies (typically the defence of towns/cities): in the 14th century, Joanna of Flanders "was armed and armored and rode on a large horse from street to street, rallying everyone and summoning them to join the defense" and "asked the women of the town, the nobles as well as the others, to bring stones to the walls and to throw these on the attackers, as well as pots filled with lime." While the stone-throwing women might not count as warriors, they fought in battle, and Joanna herself fought as a warrior.
Perhaps the most frequent occurrence of women warriors was among herding peoples on the Eurasian steppe. Again, folklore, history, and archaeology are in agreement. Folklore gives us Amazons. Folklore/history gives us remarkable women such as Khutulun, daughter of Kaidu Khan, khan of the Chagatai Khanate, who not only fought in battles but was also a superb wrestler. History gives us European visitors expressing great surprise that unmarried Mongol women could and sometimes did serve in the army. Women often accompanied steppe armies, and would fight in emergency even if they did not do so regularly. For example, the women accompanying the Timurid army guarded the camp when the army was away from camp, at times fighting to do so. In addition, some of them sometimes fought with the main army in battles. Archery and horse(wo)manship were key military skills on the steppe, and many women were skilled in both, and could contribute in battle. Archaeology gives us Sarmatian and Scythian warrior women, and also warrior women from Mongolia. Unlike the Scandinavian case, with the Solør warrior woman as the only known case with wounds, many warrior women with wounds have been found on the steppe.
From elsewhere, we have:
Ancient China: the "Lady of Yue", skilled archer and swordswoman, who worked as a trainer for the army of Yue.
Ancient Egypt: Hatshepsut and Ahhotep I, women who led armies, and may have fought in person.
Song China: Liang Hongyu, general, skilled archer and swordswoman, who commanded armies and fought in person, at times leading charges into the enemy ranks.
Medieval Japan: Tomoe Gozen, famed for her strength, skill with sword, bow, and horse, and taker of heads in battle. Other women took part in battle in Japan, including some much more historically reliable cases, but Tomoe Gozen is the best known (and despite being usually depicted with a naginata, is not described as using such a weapon in the older sources).
Aceh, c. 1600: Keumalahayati (AKA Malahayati) was an admiral who fought, among others, the Portuguese and Dutch, killed in battle fighting a Portuguese fleet.
Ayutthaya (Thailand): Suriyothai (AKA Mahathewi), a 16th century queen who accompanied her husband on the battlefield. Killed in close combat riding her war elephant in battle with a Burmese army, protecting her husband: https://commons.wikimedia.org/wiki/File:Queen_Suriyothai_elephant_combat.jpg
The early Islamic conquests give us: Nusaybah bint Ka'ab, who fought in multiple battles, defending the Prophet in the Battle of Uhud, Khawlah bint al-Azwar, who commanded troops and fought in multiple battles, most notably Yarmouk, where she led a group of women, and was wounded, and Asmā' bint Abi Bakr and Hind bint Utbah, who also fought at Yarmouk.
From the Americas, we have more recent examples of women who fought as warriors, such as:
Moving Robe Woman (AKA Tashenamani) who fought in the Battle of Little Big Horn, and is sometimes credited with killing Custer.
Lozen, who fought alongside her brother Victorio, in the Apache Wars.
just to name two of the best-known women. From sub-Saharan Africa, we have some early modern examples, such as:
Queen Nzinga, who was a 16th century queen and military leader, but also noted for her skills in martial arts.
The Dahomey Amazons, supposedly founded in the 17th century - an example of an organised military unit composed of women. They fought in battle, including against the French in the late 19th century, impressing the French more by their courage, discipline, and skill in hand-to-hand combat than their markswomanship. https://commons.wikimedia.org/wiki/File:Dahomey_amazon2.jpg
Thus, while armies were mostly, usually almost all, men, women did fight on occasions. In some places and times, women were strictly excluded (but sometimes still fought disguised as men). Reasons for such prohibitions varied. Sometimes, it was simply strict enforcement of gender roles. Sometimes, it was supposedly pragmatic, since women would only be a small (and supposedly inferior) part of the army, but would cause a large amount of disruption (by distracting the men in battle, causing trouble in camp, etc.). Only rarely have women made up a large fraction of armies - only of the few exceptions is the above-mentioned Dahomey Amazons, who at times were about 1/3 of the army.