The colonial mansion that John and his wife move into has stood empty an isolated for a long time, and John is able to rent it cheaply. The narrator says:
It is quite alone, standing well back from the road, quite three miles from the village. It makes me think of English places that you read about, for there are hedges and walls and gates that lock, and lots of separate little houses for the gardeners and people.
Other than that, its history is a blank slate. However, a colonial mansion would speak to the patriarchal history of the United States, symbolizing a legacy which allows John to take over his wife's treatment, ignore her requests for change, and treat her like a young child.
John says he rents the house because it is cheap, and because being isolated, it will help her with the rest cure that is supposed to lead to her recovery from postpartum depression.
The narrator is very uncomfortable in the house, although she tries to go along with the idea that it is a "beautiful" place to be. In reality, she finds it lonely and depressing. She dislikes being kept in one room, dislikes the bars on the windows, which make her feel imprisoned, and especially dislikes the ugly yellow wallpaper. It is even possible that the house is still a working asylum—see the quote above about the locks, etc.—and that this information is kept from the narrator. For example, she writes:
There is a beautiful shaded lane that runs down there from the house. I always fancy I see people walking in these numerous paths and arbors, but John has cautioned me not to give way to fancy in the least.
It is possible that the narrator really is seeing other patients, but that is ambiguous and open to interpretation. It is also possible that the place is an unused former asylum and that the narrator's loneliness causes her to imagine seeing other people.
Whatever the case, the setting is creepy and oppressive to the narrator, not helpful to her recovery.
The main character in "The Yellow Wallpaper" is living in an old colonial mansion because she has postpartum depression. In the era from which the book comes, postpartum depression was very poorly understood and was called "temporary nervous depression." Like many ailments in those days, the typical treatment that was prescribed was to get fresh air out in the country. To do this, the heroine's husband rents an old colonial mansion in the countryside.
The mansion was selected because it was once a very wealthy estate where the children were tended to by nannies and other nurses. This was done so that the heroine could feel as if the pressures of motherhood were removed from her shoulders. The narrator, however, hates this house. It makes her feel trapped, and the wallpaper in her bedroom in particular causes her to slowly lose her mind. She detests the yellow wallpaper and the trapped feeling she has in the house. She feels like there is something wrong with the house—like it's haunted—and the confusion slowly drives her mad.
The protagonist of the story has been brought to this "colonial mansion, a hereditary estate" as a part of her husband's treatment of her "slight hysterical tendency." She has recently had a child, and she appears to be nervous and agitated around the infant (and so her sister-in-law manages his care). The narrator is uncomfortable and believes that her husband is overreacting to her "nervous condition" by confining her to this house and preventing her from having any mental or social stimulation.
The narrator describes the mansion as having been "let so cheaply" to her family after having "stood so long untenanted." Further, there are some oddities about her room: there are bars on the windows, for instance. There is also a gate at the top of the stairs, the giant bed is nailed down, and there are "rings and things in the walls." Why on earth would children need a giant bed or for it to be nailed down? Why would there need to be bars on the doors or a gate at the stairs if the children who supposedly lived there were watched by governesses and nursemaids? What possible call would there be for what sounds like restraining devices on the walls? No, it seems more likely that this is a place where people take their wives to recover from whatever has caused their "hysteria." The bars prevent the women from jumping, just as the narrator herself considers; the gate keeps them captive.
The narrator had just had a baby, and afterwards, had been feeling down and depressed. Today, we know this as post-partum depression; in her day, it was labelled as an unknown "temporary nervous depression." Her husband, a doctor, determines that she needs to get away from her busy life and rest. He chooses to rent out an old colonial mansion in the countryside. Supposedly, the removal from busy pressures and responsibilities of her old life, in combination with the fresh country air, will help the narrator to rest and recover.
The mansion was home to wealthy people at one point; she is put in the nursery, a room where children were tended by their nannies. She describes the torn wallpaper, the marks in the wood of the bed, and other signs of children having been in the room. The mansion is empty now because of "legal trouble...about the heirs and coheirs." So the people that were supposed to inherit the estate are having money problems, so it's been emptied and rented for cheap.
The narrator hates the place, especially the room she's been put into. She feels right off that there is "something wrong" with it; at first she thinks it is haunted, but dismisses it and tries to be happy with her circumstances. However, as time passes, her distaste for the house, and especially the wallpaper in her room, grows, then turns into a strange and unhealthy fascination.
I hope that those thoughts helped; good luck!