In the US we have laws stating that someone suicidal can be made to stay in a hospital for a few days (no more than 72 hours). Most professionals agree that the 72 hour stay does very little, sometimes making someones mental health worse if someone gets a medical bill. We used to have "asylums", but those were inhumane. They were closed down and we didn't replace them with anything. Most people with mental health issues who don't have family members who can let them stay (and sometimes the ill person is violent making it unsafe for them to stay) live in the streets or commit a crime bad enough to put them in jail.
In New York (the state) we have Kendra's Law which goes much further in identifying people who are at risk to hurt others. It works much better, but people who are homeless can fall through the cracks.
In your country, can someone be "forced" into mental health treatment?