Oh, not always @RhaenysRocks , I lived in one for three years back in the late eighties/early nineties - the first two years were single sex, and the third year became mixed due to changes in nurse training.
The first two years, single sex, felt oppressive. Girls sneaked boys in anyway, and we had a 'matron' type housekeeper who clearly believed we were agents of Original Sin. It was like being in Jane Eyre.
When the boys moved in, well, there was some adjusting to do. But, just as before, everyone had their own rooms, and to be honest the atmosphere relaxed quite a lot. It was certainly no less safe.
So, I can see why single-sex are essential for specific places like DV hostels/safe houses. But, generally - no, unless you're a nun or monk, society is mixed-sex and it helps nobody to live in isolation.