From Avert.org:
The most commonly accepted theory is that of the 'hunter'. In this scenario, SIVcpz was transferred to humans as a result of chimps being killed and eaten or their blood getting into cuts or wounds on the hunter. Normally the hunter's body would have fought off SIV, but on a few occasions it adapted itself within its new human host and became HIV-1. The fact that there were several different early strains of HIV, each with a slightly different genetic make-up (the most common of which was HIV-1 group M), would support this theory: every time it passed from a chimpanzee to a man, it would have developed in a slightly different way within his body, and thus produced a slightly different strain.
An article published in The Lancet in 20044, also shows how retroviral transfer from primates to hunters is still occurring even today. In a sample of 1099 individuals in Cameroon , they discovered ten (1%) were infected with SFV (Simian Foamy Virus), an illness which, like SIV, was previously thought only to infect primates. All these infections were believed to have been acquired through the butchering and consumption of monkey and ape meat. Discoveries such as this have led to calls for an outright ban on bushmeat hunting to prevent simian viruses being passed to humans.
Just an "FYI", but soldiers are tested for HIV prior to being deployed overseas.