To compare means to explore similarities; to contrast means to explore differences. I suspect that you may be looking to do either/or, and to contrast the two settings would be simpler than to compare. I will, however, take you at your word and try to compare the two settings. Even if you did mean to write "compare or contrast" you'll still have your answer.
To compare the two settings, however, one needs to use the full definition of the word, "setting." Setting is more than the physical place of a story. Admittedly, the physical locations of the two stories couldn't be more different: an average middle class home and a mental hospital. But setting also includes historical time and social milieu or social environment. One of the stories was published in 1892 and the other 1894. This doesn't mean that the stories are set in the same time period, but the authors are at least partially a product of the same time period.
Another way to think about setting is to look at what characters know--this, too, is included in the setting of a work. If we concentrate on the social environment and what the characters know, the settings of these two stories are indeed similar.
Both settings feature a world dominated by men--not dictator-like domination, but domination never the less. The women are expected to be subservient to men. The men "call the shots," if you will. The women are not allowed to be creative or to think for themselves. In "Story," when Mrs. Mallard repeats under her breath, "free, free, free!" she is referring to mental freedom, the ability to make decisions and think for herself, and the ability just to do what she wants. In "Wallpaper," the narrator is forbidden to "work" and writes only "in spite of them (her husband and brother, both physicians)." In the end, her creative mind will not be caged and she incorporates herself into the wallpaper.
What cements this male dominated environment as part of the setting is that female subservience is not only accepted but expected by all characters in the stories except for Mrs. Mallard and her counterpart.
Note that the men are entirely normal. They are not abusive or cruel. Mrs. Mallard is unhappy with a normal, accepted relationship, with the way husband and wife are supposed to live together in the America of her day. Note, too, that in "Wallpaper," the husband (and brother) think they are doing what's best for the narrator. The men are products of society. And, in these cases, the society is that of the authors: patriarchal America in the late 1800's. That is the setting, too.