Change HIV for any chronic disease that eliminates the ability for the person to do the job they were hired to do, and you'll see that they're not discriminating against just one group of people. The military doesn't want any liabilities or dead weight. They also want to be able to deploy the people they're paying.

My friend was a captain in the Army (infantry) a few years ago, when he developed acute pneumonia. He had scarring on his lungs and decreased breathing capacity. He could still work at something (not infantry) and the Army didn't kick him out, but he went 2 cycles without being promoted. The message was that he needed to quit the Army, so he did.

It's the way it is and people (should) know it before they enlist.