Well, they're all basically locked in a submarine, but way worse. You're in a sealed box hurtling through space. You need a doctor on board, and you need a counselor on board. If you don't want both of them to go completely insane, both of them also need friends and social interaction.
While I agree that Starfleet levels of general fraternization are a lot looser than in modern military, I also think it's just kind of something you learn to live with when you serve on a ship.