The HIV virus can enter the body in several ways. One of course is directly into the blood stream through injections, cuts, abrasions or any other form of a break in the surface layer. These breaks in the continuity of the surface need not be obvious and can be quite inconspicuous or even microscopic. It can also permeate through areas of inflammation (which is why any form of infection in the vagina, rectum and mouth make HIV infection more likely if exposed). The virus can also enter through the intact mucus membrane in the vagina, rectum, mouth and on the penis and other parts of the body. Lastly the virus can enter when swallowed which is why there is a risk involved in oral sex and why babies are at risk when they are given breast milk from infected women.
Casual penetrative sex is very risky, as you may not know if the partner is infected with HIV. The safest behaviour is avoiding all casual sex. A proper and invariable use of a condom cuts the risk to a very large extant but does not guarantee 100% safety.