At the time that The Yellow Wallpaper was written and published, it was common for women to be diagnosed with a mental illness known as "hysteria." In the nineteenth century, hysteria was understood to be an exclusively female affliction.
One of the forms of curing hysteria was a method known as the "rest cure," which involved isolating a woman and forbidding her from "mentally strenuous" activities such as reading and writing. Instead, the woman was expected to participate in "domestic" activities, or she was confined to complete bed rest. This is the situation that the woman in The Yellow Wallpaper finds herself in. She has been diagnosed with "a temporary nervous depression—a slight hysterical tendency," and as a result, she is made to retire to an old mansion for the summer.
The woman and her husband move into the upstairs nursery. As part of her treatment, the woman is forbidden from working, despite her protests that she wishes to do so. She does not want to be isolated, particularly not from her child. However, as she has been deemed to be of unsound mind, her pleas are not taken as rational and are altogether ignored. The rest of the story details the woman's descent into madness. She begins to hallucinate, culminating in a vision of a woman trapped behind the yellow wallpaper of the nursery.
The Yellow Wallpaper therefore highlights the mistreatment of women by the male-dominated medical sphere of the nineteenth century. A woman could be termed "hysterical" for behaving outside of the norms imposed upon her gender at the time. This is why hysteria was most often diagnosed in women who possessed an education and women who were writers. It is also why the most common treatment for hysteria was to force the woman to live a "domestic" life, as befitting her gender. A woman was considered to be cured of hysteria if she became "subdued, docile, silent, and, above all, subject to the will and voice of the physician." Mental illness in The Yellow Wallpaper therefore serves as a realistic symbol of the oppression and lack of agency that women at the time experienced.