He said: "If you expel prostitution from society you will unsettle everything on account of lusts."
Basically that without that outlet society may spiral to deeper levels to satisfy their desires.
Not a Church approved view, but then again St. Augustine is not infallible.
Incidentally Aquinas (even though he held prostitution to be evil) also advocated the social tolerance of prostitution to avoid greater evils. Quotes below from here:
link
Given this strong condemnation of fornication and prostitution, it would seem obvious that Aquinas would want to engage every force against them, especially civil law. Oddly enough he does not. Instead he notes that the state should allow fornication and prostitution to exist for the sake of the common good.
Relying on the well-known passage from Augustine's De ordine, Aquinas advocates tolerance of prostitution by noting: "Accordingly in human government also, those who are in authority rightly tolerate certain evils, lest certain goods be lost, or certain evils be incurred: thus Augustine says [De ordine 2.4]: If you do away with harlots, the world will be convulsed with lust."
If these social practices were to be suppressed, the public reaction might be such as to threaten the peace of society. Remember, Aquinas already maintains (1) that prostitution is a species of lust that is one of the capital vices that wreak the greatest havoc on the human soul and leads to other sins; (2) that it is a mortal sin that threatens the proper rearing of children and by extension threatens the common good of society; and (3) that it violates the natural law and matrimonial union. How then could one tolerate such an evil, particularly a natural law thinker such as Aquinas? Is Aquinas compromising on his principles or playing utilitarian?
To be clear, I and many others disagree with the above, but two great theologians do make the argument. Now many others oppose it as contrary to human dignity in a way that can not be justified by common good.