[Edit] I realize that this is based off a story but hypothetically if this happened IRL in the same time period the movie is set in,what would happen?
Alright, Hua Mulan. In most traditions of the story she was a resident of the state of Northern Wei, the longest-lasting of the Northern Dynasties (386-535CE) of the Northern & Southern Period (420-589CE). There are, of course, other tellings that put her in the Sui/Tang period, and certain others that put her in a nebulous “sometime in ancient and faraway musical Chiiiiina”… but most tellings put her in Northern Wei.
This creates from the outset some very interesting and problematic issues with the Disnified version. For one, though Mulan and her people are indeed called to serve against invaders, it’s never specified in the Ballad of Mulan which invaders they’re talking about, and it certainly never talks about “Get[ting] down to business to defeat the Huns/Xiongnü”… because, well, the “Huns” were already there, in Northern Wei… as its emperors, officials, and population. Northern Wei was a Tuoba xianbei state that had partially sinified itself… but was still viewed by the Southern Han Chinese (of the Liu Song and Southern Qi Dynasties, respectively) as themselves the barbarians. From the Ballad of Mulan:
昨夜见军帖,可汗大点兵.
trans: ““Last night I saw the draft posters, The Khan is calling many troops."
From later on in the poem, after Mulan and her army has won the war:
归来见天子,天子坐明堂。策勋十二转,赏赐百千强。可汗问所欲,木兰不用尚书郎,愿驰千里足,送儿还故乡。
trans: “On her return she sees the Son of Heaven, The Son of Heaven sits in the Splendid Hall. He gives out promotions in twelve ranks And prizes of a hundred thousand and more. The Khan asks her what she desires. “Mulan has no use for a minister’s post. I wish to ride a swift mount, To take me back to my home.”
The Son of Heaven is the Khan, and the Khan is the Son of Heaven. Flibbity-flibbity-floo. The fact of the matter is that especially northern Chinese history is far, far more of a cultural and ethnic melting pot than quite a few realize, or would care to admit.
So these invaders could have been the Chinese themselves, or the Tibetans, or Tuyuhun, or the Ruanruan Khannate (which seems a likely choice)… but the one thing they were not were the Huns/Xiongnü… because neither existed in any meaningful capacity by this point. But ah well, I’m getting off topic…
We can infer quite a bit about the era she lived in and the likely consequences of her actions by the reactions of those around her – both her family, and later on the soldiers she’s come to lead in combat:
可汗大点兵。军书十二卷,卷卷有爷名。阿爷无大儿,木兰无长兄。愿为市鞍马,从此替爷征。
东市买骏马,西市买鞍鞯,南市买辔头,北市买长鞭。旦辞爷娘去,暮宿黄河边。不闻爷娘唤女声,但闻黄河流水鸣溅溅。旦辞黄河去,暮至黑山头。不闻爷娘唤女声,但闻燕山胡骑鸣啾啾。
万里赴戎机,关山度若飞。朔气传金柝,寒光照铁衣。将军百战死,壮士十年归。
trans: The Khan is calling many troops. The army list is in twelve scrolls, On every scroll there’s Father’s name. Father has no grown up son, Mulan has no elder brother. I want to buy a saddle and horse, And serve in the army in Father’s place.”
In the East Market she buys a spirited horse, In the West Market she buys a saddle, In the South Market she buys a bridle, In the North Market she buys a long whip. At dawn she takes leave of Father and Mother, In the evening camps on the Yellow River’s bank. She doesn’t hear the sound of Father and Mother calling, She only hears the Yellow River’s flowing water cry tsien tsien.
She goes ten thousand miles on the business of war, She crosses passes and mountains like flying. Northern gusts carry the rattle of army pots, Chilly light shines on iron armor. Generals die in a hundred battles, Stout soldiers return after ten years.
She's not sneaking off in the middle of the night on a stolen horse with a borrowed saddle. She says to her parents, "hey, Dad can't go fight, I'm gonna go buy a horse and go off to war." And her parents don't try to stop her. Yeah, sure, they're sad and all, but such is life in a time of war. What they're not terribly concerned about is the fact that she's a girl.
Because the historical Mulan isn't some pale-face beauty (ok, well she is, but that's not her only or even most important quality.) The Ballad paints Mulan as more of an Ellen Ripley-esque certifiable badass. There's no "I'll Make A Man Out of You" montage in the poem, because she is beating the snot out of her fellow soldiers from day one. Even the Khan take note:
On her return she sees the Son of Heaven, The Son of Heaven sits in the Splendid Hall. He gives out promotions in twelve ranks And prizes of a hundred thousand and more. The Khan asks her what she desires. “Mulan has no use for a minister’s post. I wish to ride a swift mount, To take me back to my home.”
Moreover, there's no mid-war gender-reveal. Instead, she reveals she "he's" been a "she" these past 12 year only after the war, and voluntarily to her brothers-in-arms:
脱我战时袍,著我旧时裳。当窗理云鬓,对镜帖花黄。出门看火伴,火伴皆惊忙:同行十二年,不知木兰是女郎。
雄兔脚扑朔,雌兔眼迷离;双兔傍地走,安能辨我是雄雌?
“I open the door to my east chamber, I sit on my couch in the west room, I take off my war time gown, and put on my old time clothes.” Facing the window she fixes her cloud like hair, Hanging up a mirror she dabs on yellow flower powder. She goes out the door and sees her comrades. Her comrades are all amazed and perplexed. Traveling together for twelve years They didn’t know Mulan was a girl.
“The he hare’s feet go hop and skip, The she hare’s eyes are muddled and fuddled. Two hares running side by side close to the ground, How can they tell if I am he or she?"
Her comrades are all sorts of "amazed and perplexed" that this ultimate badass was a smokin' hottie the whole time, yes, but she obviously believes that there's no danger in letting them know. No punitive action is going to be taken against her... certainly nothing like Shen threatening her at swordpoint for the crime of saving his live while having gross girl-germs.
This hearkens back to the fact that Northern Wei, for all it desperately wanted to be, was not totally culturally Chinese... it still had many of the social and gender norms inherited from the Asian steppes and their formerly nomadic traditions - traditions like boys and girls should be trained to fight and defend their home, they should all be capable with the horse, bow, and sword... and that it was not entirely unheard of for men and women to serve alongside one another.
Moreover, Mulan in all her tellings serves as a paragon of the Chinese Virtue Above All Other Virtues: filial piety. Sure, she's a girl, but her dad has no grown sons, and he can't effectively serve his lord... she she helps him by serving the khan on his behalf. That is hardly something to be punished in Chinese value systems.
This does change - as does the story itself - if it moves to a different time period. Chu Renhou's The Sui Tang Romance moves the tale of Mulan up in time to the Tang overthrow of the Sui, ca. 618 CE. moreover, it was written in the Qing Dynasty of the late 17th century. Now, Chu borrowed heavily (and copied verbatim in more than a few places) from the earlier (pub. 1633) Forgotten Tales of the Sui Dynasty. Nevertheless, it is very very focused on the idea of suicide or ritual defacement to establish its female characters with virtue and honor equal to men. Thus, in the tale of Hua Mulan, we first get a twist of her being found out, but by the warrior-princess Dou Xianniang, who tries to recruit Mulan as a man, but then pledges to keep her secret and becomes sworn sisters. But by the end of the tale, Xianniang's father is captured by the soon-to-be-Emperor Taizong of Tang, and they surrender themselves to suffer his punishment in his stead. Taizong sees this as a supreme act of filial piety and (in the book) commute the death sentence of Dou Jiande (in reality, no, Dou was executed), and Mulan sent home to relocate her parents. Harsh reality sets in, however, when she discovers that her father has died, and her mother remarried. Worse comes to worst when Taizong's ally the Göktürk Khan summons her to his capital to become one of his concubines... at which point she decides to commit suicide rather than suffer such a fate. From Martin W. Huang:
Her suicide is particularly baffling since at the time she is not in love or engaged with anyone and since she is only half-Chinese (her father Turkish, but her mother is Chinese). Hegel provides the possible explanation that this is intended to be a loyalist message: “even a half-Chinese woman would prefer death by her own hand to serving a foreign ruler.” Also worth mentioning here is Mulan’s explanation for why she has masqueraded as a man to join the military: “Feeling ashamed that there were not many loyal subjects and filial sons among men, I decided to take the risk to dress myself as a man.” Here Mulan is apparently blaming the incompetence of men as one of the reasons that she felt compelled to join the military. In other words, there would have been no need for her to do so if men had been competent enough to fulfill their duties.
Yet even in this telling where her femaleness does result in tragedy, it's again not the emperor or a military officer threatening to cut her down for her womanhood... indeed, though Taizong was prepared to have her and Xianniang executed, that was because they were captured enemy combatants, not because they were women. (Hell, Taizong's own sister, Princess Pingyang, was leading her own anti-Sui "Women Peasant Army" at this same time... and I should note that the Tang rulers were themselves semi-Turkic). Rather, the issue is having her fate taken out of her own hands as a result: going from being a respected army officer, to being the concubine of a foreign lord.