system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How is the Church of Scientology legally allowed to have a heavily guarded base and prison?
gpt
It's based on consent. The people who are there ostensibly consent to the treatment as part of their "rehabilitation" or therapy or whatever. Think of it like S&M: that stuff is assault on the street, but if grown-ups are ok with it, it's not criminal. 

I suspect Scientology has paperwork for all the people in those facilities where they signed (perhaps under duress, perhaps not) acknowledging their consent. Doesn't mean those involved can't later change their mind, but it probably establishes reasonable doubt to preclude prosecution and protect the church from civil suit.