Sometimes it is. I've had a few TB patients who ended up receiving the entirety of their treatment in custody because they wouldn't stick to it, though this depends greatly on the judge. No one likes putting these folks in jail and it should always be a last resort, but it does happen.