For HPV, which is easier to transmit than
herpes, sometimes
skin to
skin contact without a lot of friction can transmit.
Herpes requires a bit more friction (rubbing). In both, transmission depends on a lot of things - are symptoms present (indicating that the level of virus is high)? What strain of either is present? Are condoms, which reduces the risk by at least half, used?
HPV is so common that many experts, the CDC, etc., consider it an inevitable part of having sex.