Loris Vezzali answers
I think it matters whose perspective you take. Positing that engaging in perspective-taking can generally produce positive effects, I think that reading fiction dealing with prejudice—and specifically, contact between characters belonging to advantaged and disadvantaged groups—can reduce prejudice when you are able to identify with the main character. This way, you can can understand the character’s perspective on the hierarchical structure of societies and the suffering of stigmatized people, and generalize it to real-world social categories. This can make people more tolerant and open-minded in real life.
For instance, in the Harry Potter books, readers could understand that some groups, such as the elves or the muggles, were marginalized and stigmatized in the magical society, and link this information to stigmatized groups in the real world (such as immigrants and homosexuals). They could thus empathize with several types of real-world stigmatized groups, so improving attitudes toward them.
There might be other mechanisms as well, in addition to empathy/perspective-taking. What is important is that readers understand that the society may be unjust AND that it is important to do something to address these injustice.
Loris Vezzali is a professor in the department of education and human sciences at the University of Modena and Reggio Emilia in Italy.