I suggest you learn to read more carefully. I did not suggest syphilis would be eliminated by making extramarital sex illegal. I said its incidence would be reduced. If you make something more expensive people do less of it. Fewer people smoke marijuana now than will once itβs legal because part of the cost is the possibility of a criminal record and all that entails.
Infections would fall by the amount caused by extramarital sex, multiplied by the probability that people are actually deterred by illegality, plus network effects. That won't completely eradicate syphilis, but still lower the numbers.