The Catechism of the Catholic Church has a paragraph on each of pornography and prostitution. I've emphasised a couple of passages which indicate an opinion that neither should be legalised:
2354 Pornography consists in removing real or simulated sexual acts from the intimacy of the partners, in order to display them deliberately to third parties. It offends against chastity because it perverts the conjugal act, the intimate giving of spouses to each other. It does grave injury to the dignity of its participants (actors, vendors, the public), since each one becomes an object of base pleasure and illicit profit for others. It immerses all who are involved in the illusion of a fantasy world. It is a grave offense. Civil authorities should prevent the production and distribution of pornographic materials.
2355 Prostitution does injury to the dignity of the person who engages in it, reducing the person to an instrument of sexual pleasure. the one who pays sins gravely against himself: he violates the chastity to which his Baptism pledged him and defiles his body, the temple of the Holy Spirit. Prostitution is a social scourge. It usually involves women, but also men, children, and adolescents (The latter two cases involve the added sin of scandal.). While it is always gravely sinful to engage in prostitution, the imputability of the offense can be attenuated by destitution, blackmail, or social pressure.
This is part of the theology of the body which was particularly beloved of Pope St John Paul II, who wrote in Evangelium vitae (my emphases again):
The Second Vatican Council, in a passage which retains all its relevance today, forcefully condemned a number of crimes and attacks against human life. Thirty years later, taking up the words of the Council and with the same forcefulness I repeat that condemnation in the name of the whole Church, certain that I am interpreting the genuine sentiment of every upright conscience: "Whatever is opposed to life itself, such as any type of murder, genocide, abortion, euthanasia, or wilful self-destruction, whatever violates the integrity of the human person, such as mutilation, torments inflicted on body or mind, attempts to coerce the will itself; whatever insults human dignity, such as subhuman living conditions, arbitrary imprisonment, deportation, slavery, prostitution, the selling of women and children; as well as disgraceful working conditions, where people are treated as mere instruments of gain rather than as free and responsible persons; all these things and others like them are infamies indeed. They poison human society, and they do more harm to those who practise them than to those who suffer from the injury. Moreover, they are a supreme dishonour to the Creator".
It is not difficult to add pornography to the list as insulting human dignity. The quote contained in this excerpt is from the Council's Apostolic Constitution Gaudium et Spes 27.
However, in saying that prostitution is a social scourge and an act of violence, the Church also recognises that it has causes which are not simply and easily dealt with in making it illegal. Because it should be illegal (and is, in many countries), compassion needs to be shown to those who are forced into it by circumstance; equally, those circumstances need be fixed.
If it were not illegal, then it would be easy [or easier, perhaps] to argue that none of its causation is unjust.
- Prostitution is a form of modern day slavery
It is important to recognize that sexual exploitation, prostitution and trafficking of human beings are all acts of violence against women and as such constitute an offence to the dignity of women and are a grave violation of basic human rights. The number of women of the street has increased dramatically throughout the world for a variety of complex economic, social and cultural reasons. In some cases the women involved have experienced pathological violence or sexual abuse since childhood. Others have been driven into prostitution in order to have sufficient means of living for themselves or their families. Some search for a father figure or a loving relationship with a man. Others are trying to pay off unreasonable debts. Some leave situations of poverty in their country of origin, believing that the job being offered overseas will change their lives. It is clear that the sexual exploitation of women that pervades the world’s social fabric is a consequence of many unjust systems.
Pontifical Council for the Pastoral Care of Migrants and Itinerant People: 1st International Meeting of Pastoral Care for the Liberation of Women of the Street