This is called in-patient rehab, although the person going through rehab is not typically physically confined and can leave if they want. Remember, like Britney Spears did?
You can get someone committed for X # of days with a little help from the courts, but that is not typically rehab, they just get medically detoxed.
Is this person ready to quit? If not then it most likely will not do any good regardless of what method of detox and/or rehab is used.