Setting is one of the primary ways in which an author is able to introduce conflict. The author places characters in places and times to ensure that conflict will occur.
For example, take F. Scott Fitzgerald's The Great Gatsby. It's setting is New York in the 1920s, a time and place where new moneyed people—actors, musicians, filmmakers, etc.—were enjoying great success. In addition, it was during Prohibition, an era in which alcohol was outlawed, but people still drank in certain safe places like speakeasies. It was also a time when gangsterism exploded and people, like Jay Gatsby, experienced immense success and made tons of money.
So how does this play in the conflict?
One of the novel's primary conflicts is Old Money versus New Money. Those with the old money, like Tom and Daisy Buchanan, expressed distaste for the newly rich, like Gatsby. While Tom turns out to be correct here, his distaste for the New Moneyed people are concisely expressed here: "A lot of these newly rich people are just big bootleggers, you know."
Without this conflict, Tom does not look into Gatsby and doesn't find out he is, in fact, a bootlegger. If Gatsby had come from Old Money like Tom, the conflict here does not occur and Tom does not look into Jay's past. There is no story, in fact, because, without this setting (1920s America), Daisy would be able to marry Jay even though he wasn't from an old family.
This is the larger cultural setting of The Great Gatsby, but the smaller settings in the novel are just as important. For example, the climax of the novel occurs on the hottest day of summer, right before autumn breaks. The heat plays into the short tempers and eventual near fight between Jay and Tom.
This interplay happens in nearly every story and novel. Without a setting that places characters in specific situations, the novel or story loses its specific effect. Gatsby could work in 2015s New York, but the conflict between Old Money and New Money probably doesn't happen and the hottest day of the year would be alleviated by air conditioning. The author would have to create new settings that would create different conflicts.