Whether one is discussing poetry, fiction, drama, or any other form of literature, the time and place of the literary work, also known as the setting, is essential to understanding the author's theme. Closely related to the setting is the historical context of the literary work. For example, the setting of Anne Frank's diary, and the play based on her diary, is a set of rooms converted into an apartment above Otto Frank's offices (setting) in Amsterdam during World War II when the Nazi regime was dominating Europe and deporting/murdering Jews in record numbers (historical context).
Understanding a poem is much the same; if a poet has written a literary work with an eye toward a certain time and place, it is likely because the theme will be better communicated through the setting, i.e. the setting will not be chosen randomly. In Edna St. Vincent Millay's "Memory of Cape Cod", she speaks of the beaches of Truro in Massachusetts, and draws her memories, and the theme of missed opportunities that flow from them, directly from her time at the beach: "The wind in the ash tree sounds like the surf on the beach at Truro. . .". Fellow New Englander Robert Frost, in "Stopping by Woods on a Snowy Evening" also uses a nature setting, that of a nighttime snowfall; it has been suggested that he was creating a comparison between the woods, which are "lovely, dark and deep" with the inevitability of death.