What hilbert42 says is very relatable to me even if it never got so bad for me.
I can't stress enough how everything is different "when one can't 'go home' during off hours". I used to be an enlisted sailor, then an officer. It's sometimes hard to have a few minutes alone in an entire day (night included), especially on smaller or older ships. After a few months any small thing can become a very nasty fight very fast. The word "microagression" suddenly makes a lot of sense. I once got into a fight because some guy thought I had slightly moved his towel that was in front of my bunk. This man had been at sea on the ship for more than 6 month, I had joined mid-tour a month before.
I've seen a male-only boat (there were one or two female officers, which was accepted because of the bathroom configuration) get one female enlisted sailor, a talented and very professional young woman. Everything changed in one day. Though submariners are often a bit more mature than others, managing a mixed crew on a small ship is very different.
Remember the average age on a military ship is rarely above 25.
Sexual harassment is not the hardest, since everyone is with everyone 24/7, most cases are very clear cut. I've seen a few very nasty cases (sexual predator that went undetected for months or year, a guy that wasn't reported despite a suspected rape attempt and went on to assault someone on his next ship under my command, a false rape claim) but it's mostly straightforward to handle. A lot of officers don't close their doors when doing personal review or other one-to-one interviews and conversations with female sailors but the paranoia mostly stops there.
Dealing with "regular" harassment, rumours, jealousy etc is way less simple with a mixed crew, regardless of the personal qualities of the people. And of course your management style has to be adapted. When you have more than a few (young) women in a team, you have to lead differently. (Women over 40 are rarely on the "bad" side (when there is a clear one) of those problems).
I've seen quite a few of those cases. Sometimes, we've been successful in stopping them before harm gets done, sometimes someone's life was ruined for months or years or people had to be transferred because trust had been broken too deep and some people couldn't work together anymore. And a few cases with legal proceedings (harassment lawsuit etc), but never handled one myself.
On a personal note I (male) have had to share a two beds room with a female for a few months. We didn't sleep a lot, and often not at the same time, never had any problems. It was a male-only boat with less than five women.
Hope this gives you an impression of what it can be like.