Is there such thing as a hereditary STD, so basically is it possible for someone to have an STD without ever having sex?
You can get that from Mother to Child by either breast milk, or blood to blood during birth.
You can get HIV A lot of ways with out having sex.
But they are not strictly hereditary - they are not passed on in the genes. The term used for infection during birth is "congenital", and both syphilis and AIDS can be passed on that way.
There aren't any that I know of carried in genes, (and that was my job, genes) but he asked "so basically is it possible for someone to have an STD without ever having sex?" Which is what I answered.
The lining of the vaginal canal can carry anything from Syphillis to Chlamydia to HIV. Some docs even highly suggest a C-Section birth and strong prophylaxis to avoid mother-to-fetus infection during birth.