I think there's a good chance that sex workers would be treated better if prostitution was legal and regulated. Obviously if the sex worker is being coerced, or otherwise mistreated, that's a bad thing. But what if a prostitute enjoys having sex or money, or at least finds it preferable to other work? Then it's a victimless crime. The reason it's illegal, in my view, is because many countries are puritanical. Look at the U.S.--booze and cigarettes kill tens of thousands a year, pot kills no one, yet that's the illegal substance.
Prohibition didn't keep people from drinking; it created a criminal enterprise (see: Al Capone) and was responsible for people drinking horrible chemicals like shoe polish. Making booze legal didn't end society's alcohol related problems, but it did make it harder for kids to buy it, and regulations kept sellers from selling toxic concoctions (even more toxic than regular booze). When I was underage it was far easier to buy illegal drugs than a six pack. Drug dealers tend not to card.
Obviously sex trafficking and child prostitution is ghastly and should not be tolerated under any circumstance. Arguably if sex work was legal and regulated that could be kept under better control.