Assuming what you've said is fully truthful, then you did the right thing, which sometimes involves not only lying but violating the law, which is necessarily too general to be a valid guide for proper behavior in all situations.
BTW, what is her clinical diagnosis? Schizophrenia?
Was it more convenient than delivering an ultimatum of having her commit herself or do one or all of the above?
It isn't simply a matter of convenience. It is a matter of caring for a loved one and protecting his kids. Your proposed alternatives would still leave her suffering from what sounds like very serious clinical psychosis and the kind of paranoia and delusions that made her a plausible danger to herself and her kids. What he described sound very much like the kind of person that winds up driving their kids into lake. If the medical professional actually did know he was lying and went along with it, its because they thought she was this level of dangerous but couldn't legally commit her without the kind of evidence that could mean its too late and she already hurt someone. Harry might not even agree that she was that dangerous to the kids because he loves her and its hard to see a loved one capable of such things until after they actually do it. But what he described sounds like the kind of problem that can and does lead people down a rabbit hole of delusion and fear where what is a grossly immoral act to the sane mind seems like an act of love to the insane mind.
Why do you suppose the law is crafted that way in the first place?
As Keith pointed out, as is common, these laws are an unreasoned over-reaction to previous abuses where people were committed without legit medical reasons and without valid clinical diagnoses of severe mental health problems (such as for being gay or merely non-conformist). The mental health profession has advance much since then and such abuses would be are far less likely now and far easier to expose them when they occur.
Her choices and decision making power were removed because you lied.
True, but "her choices" were already removed from her ability to make them in own rational self-interest by a mental disease that made rational thought impossible for her. His actions to temporarily remove her self-determination gave long term control and self-determination back to her rational mind.
While the outcome this time was justified, would you generally condone this type of behavior in others - in other situations?
Mature and reasonable morality is inherently situational and highly contextual. Whether this "type of behavior" would be condoned in other situations isn't very relevant to whether it was moral in this situation. In contrast, the law is necessarily general and for practical reasons cannot specify all situations where it ideally and morally should and should not apply. That is why what the law should say and what is moral in a given situation are always two separate questions that sometimes have the same answer and sometimes not.
Even if she never forgave him or never get better enough to understand that she had an illness, he would still have done the right thing.
Had she not improved and they continued to keep here solely because of his lie then it might have been morally neccessary to come clean about it, but not in a way that would send him to jail and leave his kids with no father and in the care of a mentally unstable mother.
A final thought is that the morality of such an action is directly dependent on the rationality of the actors thinking that leads to their conclusions supporting the action. It was moral only if the conclusion that she was a danger to herself and others was rationally based and supported by as much science as possible. This is why rational thinking is itself a moral requirement and really part of the foundation of all moral action. Although, rational thought is neccessary but insufficient to alone dictate what is moral because all morality is ultimately based on optimizing what is subjectively valued (e.g.., life, health, fair-treatment, liberty). That is why a religious person who lies to commit a gay person based on the belief they will go to hell if not "cured" is not the same and is being highly immoral in their actions, because their motivating belief is not only objectively wrong but irrational and not based on the person's best honest effort to form accurate beliefs when acting to impact others. Irrational beliefs are a selfish act of cowardice, thus all actions they drive are acts of selfish cowardice and thus immoral when the lead to objective harm to others.