Syphilis is primarily transmitted through direct contact with a syphilitic sore, known as a chancre, during vaginal, anal, or oral sex. It can also be transmitted from mother to baby during pregnancy or childbirth, leading to congenital syphilis, which can have severe consequences for the newborn.