My understanding is that the ban on homosexuals in the US military was formally established after WWII as a result of bad experiences in WWII, especially in the Navy, problems with predatory NCOs and officers. I was in the Army for 10 years 1966-1972 and 1977-1981, if there were any homosexuals they were extremely discreet about it, in contrast to
the braggarts and exhibitionists of today. When i was in the WWII policy of punishing those who contracted STDs had ended (that was a good policy, IMHO) but those who contracted STDs received neither sympathy nor understanding, nor did they expect any. One Army veteran told me that when his unit was deployed to Bosnia 10 years ago or so there was a great deal of bitterness when two suspect individuals tested HIV positive and got to stay home while everybody else froze in the mud of Ex Yugoslavia. And I can just see the headlines when some DIs get caught "reaming out" recruits or there is an outbreak of AIDS in the ranks.