In which way marriage prevent std?

It doesnt. Technically marriage has no std prevetion ability. Of course monogamy will reduce your risk, but not eliminate all risks for stds.
Marriage. Marriage, in and of itself, does not cure std's.