The main theme of Ghosts is the extent to which society invades personal lives. Mrs. Alving, obsessed with keeping up appearances, tries to protect her late husband's reputation. But because of this concern, she not only ends up living a lie and building a memorial to her husband's false reputation, but she also ruins the lives of her husband's two children, Oswald and Regina.
Pastor Manders is also ruled by a neurotic concern for public opinion. It leads him to much foolishness, to the extent that he is eventually tricked into funding Engstrand sailor's saloon. In the Pastor, we see the connection between public opinion and duty. When the Pastor tells Mrs. Alving that she must save Oswald from sin, it is unclear whether he is motivated by a pure sense of moral duty or by a deference to public opinion, because for him they are essentially the same. It is because of the Pastor's principles that he does not give in to the mutual attraction that he and Mrs. Alving share and that would have made them both happy.
Mrs. Alving's speech on "ghosts," in the second act, establishes the play's key metaphor. The "ghosts" of duty and public opinion come to dominate and ruin generations of lives. Mrs. Alving feels that all people are haunted not only by their inheritances from specific people, but by general superstitions that exist within a community. The idea of filial piety, or duty to family members above all else, is such a ghost.