The narrator of the story "The Yellow Wallpaper" is a young, middle-class wife and new mother who has been recommended S. Weird Mitchell's "rest cure" as a result of what seems to be a form of post-partum depression.
Keep in mind that we have to be very careful when we ask the question "what brought the illness". The answer is more complex than that. When the woman enters the home, she is asked to rest to cure her depression. However, Dr. Mitchell (who is addressed in the story by his real name), suggests in his treatment that she cannot exercise anything, not even her imagination. THIS latter fact is what triggers her ultimate meltdown, which would have never taken place if she had not been prescribed that anachronistic cure.
As soon as the narrator (whose name may be Jane) is told that she cannot write, draw, or do anything else but rest, she rebelliously starts a secret journal. This is what starts the story. In the journal, she begins to spiral down into an obsession with the objects around her. She is angry at her husband and resentful at her doctor, and at her sister, Jeannie. As a result, she begins to compare all around her with her own inner struggles. The most particular of such struggles is the subservient nature of her relationship with her husband who, as we can see, decides everything for her. Hence, when she begins to see "a" woman trying to crawl out of the patterns of the yellow wallpaper, it is she, seeing herself desperately trying to crawl out the pattern that has become her life. This is why, when she "helps" the woman to rip out of the yellow wallpaper, the narrator says the words
“I’ve got out at last, in spite of you and Jane.”
Therefore that is the true tragedy of the story: that this woman has to literally lose her mind in order to get a hold of herself.