HIV is an evolutionary champion. Because its information is carried as RNA rather than DNA, it has no mechanism to correct mistakes when it makes copies of itself, and the rate of mutation is fantastically high. Rapid mutation is one of the ways it escapes attack by the immune system. But this mutation rate may work to our advantage. From an evolutionary point of view, the more we practise safe sex, the more natural selection favours those HIV viruses which let the host live longer.
Unprotected sex fails to punish viruses which slay their host early.
It would be much more widespread if it were less cruel to its hosts. Humankind does have a failsafe mechanism. Although we evolve slowly, there are so many of us that there are bound to be some who, by chance, carry a natural immunity to any virus. Caroline, Princess of Wales in the early 18th century, had a robust attitude towards medical ethics. But she wanted to test it on someone else first, so she tried it on six condemned prisoners at Newgate jail.