John Stagliano contrated HIV, he has stated that he believes it occured during unprotected sex he had in, well, somewhere in south america.
It can happen to anybody.
To be honest, he probably got fucked in the ass by a HIV positive individual and the unfortunate results of that played out.
Wear condoms and get tested regularily. The porn community is probably the most safety aware group of people in the world, but shit happens.
You'll never get an STD from jacking off, so that does remain the most safe option.
That's why porn is so sweet.