"Hills Like White Elephants" is a short story by Ernest Hemingway that is ultimately about whether or not one of the two main characters will get an abortion. Most of the story is told through the conversation the two characters have with each other. This is also where we get our only information about the setting: a train station.
Trains and train tracks have always been symbolic of being at a crossroads in life. They are often used as a way for the author to convey the fact that a character is at a figurative (and in this case, perhaps even literal) crossroads in his or her life. On a surface level, the function of the setting in this story is to show that the woman (or "the girl," as the author refers to her) must decide between having her companion's baby or having the abortion he wants her to have. The track she chooses will change her life forever.
On a deeper level, the landscape beyond the train station is significant as well. The train station is located in a valley that is empty and devoid of life. The girl, Jig, comments that the hills around it, though, look like white elephants. White elephants (though they might sound interesting to us now) were once seen as something that was no good, something that people didn't want or didn't want anyone to know they had. This is clearly a metaphor for the baby.
While the girl first sees the hills as white elephants, she later says that "They're lovely hills ... They don't really look like white elephants." This is an instance of the author using the setting to show that the character is changing her mind about whether the baby is something she wants or not.