If prostitution were legalized, I think it would be crucial to require prostitutes to be regularly tested for HIV and other STDs. However, enforcing this would require setting up an entirely new system by which to make sure they've been tested, some sort of proof they have been (perhaps cards) that inform "Johns" what STDs, if any, the card holder has.
Prostitution goes on already and will continue to go on whether it is legalized or not. If we legalize it then we can at least keep people safer and better informed.