There was no belief that when this began that anyone was going to the Hospital. One cannot plan for events that seem quite unlikely before they happen.
So far as legality is concerned, the contract when you buy the ticket says they can legally remove you. Their settlement has more to do with bad publicity than it does with what is the law.
United just wants the bad publicity to go away, and at this point they don't consider their legal rights to be the more important issue at stake.
United’s own ToS say they can’t remove a legally-boarded passenger except for disruptive behavior. That means disruptive PRIOR to being singled out for ejection.
The federal mandates for Common Carriers make it illegal to actively put a passenger’s health and well-being at risk. United screwed up almost beyond what is humanly possible. How you can defend them is beyond me.