Marriage is a commitment between 2 parties. When one party can break that commitment without any drawbacks that can harm a marriage in many ways. Affairs can go on for longer, the sexual relationship with the spouse can deteriorate as well as the emotional one. Prostitution could be legalized, if divorce courts were able to access records. At least then there would be a small amount of protection for the spouse who has been betrayed.
Yes, prostitution is a threat to marriage, because men or women that want sexual relationships outside of marriage can easily find it. Anything that is not sexual relationships within the confines of a committed marriage is a threat to marriage. Prostitution is also sad for the, mostly women, who feel they have no other choice but to engage in prostitution. Society needs to rally around these women and help them find other choices.
A good healthy marriage will not be affected by prostituttion. A spouse who doesn't value loyalty will cheat no matter what, they will somehow find a way, they don't need prostituion to cheat. But a good marriage is not affected by it at all. However, I do think prostituion is bad because of other reasons such as exploitation of young women by pimps, brainwashing, rape, sex trade, etc. Some prostitues are independent, intelligent women who choose to live this life, but manyyyy are women who are of poverty or low intelligence and they are taken advantage of by pimps. They are brainwashed into thinking that their pimps love them and that they can't function without them, so they become entirely dependent on them and are exploited and taken advantage of without even realizing it. Not to mention the rape and abuse and sexism.
A good, sound marriage will not at all be threatened by the availability of prostitution. It is easy to blame services for familial problems, however, if someone has the intention to cheat they will do it with or without a prostitute. There is no reason to believe that this type of service threatens the common marriage.