He didn't tell that prostitution was fine. He exhorted sinful people (i.e. all people) to change their ways, surrender to God's will which means doing His will, not ours.
Remember Jesus kicked over tables and used a whip on some people who were desecrating the temple? You think Jesus came to tell everyone "There, there. Keep on doing whatever you're doing, it's all fine"?
Good point. Also worth mentioning is his reaction to when several followers left him after his sermon on being the Bread of Life.
They said "this is hard, who can live up to this?" and walked away. Note that he didn't chase after them, apologize, or alter the Truth to make it more comfortable for them to hear. He simply let them go.
Truth is hard for some to handle, but that doesn't make the Truth any less True.