Psychiatric hospital
A psychiatric hospital or mental institution was a  insane asylum. Funny farm was a slang term for the same. 

Following his arrival to 1967 Earth from the 29th century, Captain Braxton became disillusioned with life among "post-industrial barbarians", and – despite his best efforts to explain his situation to various authorities, notably that of being a timeship captain from the future – he was eventually placed in a mental institution where they "filled [him] with primitive pharmaceuticals." ()

In 2285, Leonard McCoy was to be sent to the Federation funny farm due to his mental issues, which had been induced by Spock's katra. ()

In 2364,  told "Dixon Hill" that if Detective Dan Bell had seen him in his "threads", he'd send him to the funny farm. ()

See also 
 Psychiatric ward

External link 
 

Medical establishments