In most jurisdictions, the police or a mental health professional can have people who are found to be a danger to themselves or others committed for a brief period of observation (usually 48 – 72 hours). Then the court can decide to commit them for further treatment, or not.
Most jurisdictions also have provisions for family members to commit for observation, under limited circumstances. You should call your local health department for direction to the correct channels.
You should also know that the great majority of treatment facilities are not locked down, and patients are free to leave (against medical advice, of course) at any time. They may face penalties for doing so, however.