When you are a danger to yourself.
When you are a danger to others.
When you are no longer taking care of yourself. The lingo for this is no longer performing the"Activities-of-daily-living" (ADLs).
When you need observation and a second opinion. When outpatient methods aren't working, going into the hospital allows many people to see you in various contexts. You are living there. They will have a perspective that your outside psychotherapist and psychopharmocologist cannot have.