The magic is all in the placenta, which keeps the mother's blood separate from the child's, and protects the child from the transmission of illnesses.
Children acquire HIV during the traumatic, blood-soaked natural birthing process. Delivery by elective caesarian section reduces risk of HIV transmission by 2/3.