Michal was an extraordinary person who'd displayed her spiritual greatness from the time she agreed to marry David after he killed Golyat (Goliath), and then later when she exhibited unswerving loyalty to David when he was pursued by her father.
Her constructive criticism of her husband's style of dancing was meant well; she had her husband's honor & and the honor of his exalted position in mind.
Yet Michal received what appears to be an extreme consequence for her reprimand:
She never had a child. (Shmuel II:6:23)
(Or she never had another child, meaning that she had children until that point. Or she had a child on the day she died, implying that she died in childbirth [Radak]. The truth is, it's even more complex than that because there are different interpretations regarding Michal and her children, who they were and when/if she had children of her own or if she raised her sister Meirav's children who were thus considered Michal's, etc.)
What gives?
The Bigger One is, the More Sternly One is Judged
This is fair because the greater a person is, the more knowledge & awareness & capability they possess.
For example, when a 2-year-old in preschool wrangles a toy away from another 2-year-old, knocking the other 2-year-old down in the process, we intervene to educate the pint-sized aggressor in the ways of good middot & civilized behavior.
However, if a 30-year-old does this to another 30-year-old at work, we call the police.
It's even likely that the 30-year-old aggressor will pay some kind of fine, suffer consequences in his career, and even serve jail time, depending.
We treat 2-year-old aggressors & 30-year-old aggressors differently because we have different expectations of their knowledge, awareness, and capabilities — and rightly so.
So we can accept Michal's consequence on that basis alone.
But there's more.
A Glimpse into One Underlying Reason
(Because of their lesser middot, they were forbidden by King David to marry into the Jewish people.)
By either killing them directly or by harming their lives by killing the Kohanim (on whom the Givonim depended for their livelihood) [Shmuel II:21], Malbim says it was decreed from Above that there should be no more descendants of King Shaul.
And this decree was revealed to King David.
Michal's misguided scorn of her husband's behavior was the final straw necessary to seal the decree against King Shaul's descendants.
And according to Malbim, this was the real reason she suffered this consequence.
In a sense, her inner scorn and her verbalized criticism were preordained because they provided the necessary act to finalize a Heavenly decree against her father's descendants.
Everything is Going according to the Master Plan
Far above our intellects are calculations that take into account all sorts of details, including past & future events.
The above does not explain everything & cannot explain everything.
But it does give us a glimpse into some of the behind-the-scenes workings and reassures us that everything is both supervised & taken care of down to the tiniest detail.