If there were nudists in the military, they could most likely shower with either sex and have no issues because most actual nudists do not view the naked human body as a sexual object normally. It is our issues (modesty) with what the majority of the US associates the human body with that makes us equate naked opposite sex body almost every time with sex. Men and women have been taught that it is not right for a man to see a woman that he is not intimate with naked, nor is it right for a woman to see a man that she is not intimate with naked. We have essentially been taught that the naked human body is a sexual object most of our lives, as heterosexuals.
But, for gay people, they wouldn't really be getting the same message. We don't teach our children that it is wrong for people of the same sex to see us naked, not for those of the same sex in a person's peer group. In fact, we normally force every school age child/teen to shower together with members of their same sex whenever they participate in group sports. Nothing sexual is seen about men or women showering together, normally. Since there is no assumed intimacy, then the message is that a man in front of a man naked is not sexual, normally, just like a woman in front of a woman naked is not sexual, normally.