Don't confuse Syphilis with Herpes. Syphilis is caused by a bacteria spirochete Treponema pallidum. Herpes is caused by a virus.
Though it was identified a century ago, sadly no approved vaccine exists. The bacteria itself is very flimsy, breaks apart easily and even difficult to grow in a lab. It has only about 1041 predicted coding sequences. It mutates to avoid the immune system. However, a US team has found that the one that varies the least is the outer membrane proteins. Further research is needed to figure out whether a vaccine could exploit this weakness.
There are a couple of vaccine candidates under test, also a recent tri-antigen vaccine, but none of these are approved. Hopefully one day someone will find a way.
PS: Syphilis does not spread by casual contact. Transmission is direct contact through sex. Also mothers can pass onto an unborn baby.