The hospital cannot legally force you to stay in the hospital unless you're in the Psychiatric unit and then they can legally force you to stay without them discharging you.
But if you're just in the hospital for sickness or injury and want to walk out of the hospital without the hospital discharging you then you're free to do so without any problems.
So you can put your clothes on and remove the hospital band from your wrist and walk right out of the hospital door without them stopping you.