The setting is obviously in the American Midwest. The time is about the time the story was published in the New Yorker in 1948. The old saying quoted by Old Man Warner tells a lot about the location as well as about the purpose and tradition of the lottery. He says, "Lottery in June, corn be heavy soon." So this is undoubtedly one of the many small farming towns in the Corn Belt, which runs from eastern Nebraska through Iowa and into southern Illinois. The people in that region who read the story or heard about it knew that they were being ridiculed and insulted by a sophisticated Eastern liberal magazine which--at that time--bragged that the world ended west of the Hudson River. Shirley Jackson was not a New Yorker, but she was born in notoriously liberal San Francisco and spent her life in that vicinity. The people in her story are still practicing human sacrifice in order to insure crop fertility. This is an obvious exaggeration. It is in the mode of Jonathan Swift's well-known "A Modest Proposal" in which he suggests that Irish infants should be exported to England to be roasted and eaten. The New Yorker was still largely a humor magazine in 1948 under editor Harold Ross. It was full of cartoons and often printed humor pieces by Robert Benchley, Dorothy Parker, S. J. Perelman, E. B. White, and James Thurber. "The Lottery" might be considered black humor.
Setting refers to time and place. The story was written in 1948, but it suggests an almost unknown era that could apply to many different times in history. The author makes this move intentionally. Readers do know that the lottery takes place in June, so we can assume late spring, early summer in terms of time.
As far as location goes, this is an unidentified location, but readers can tell it is a small enough gathering of people that everyone knows everyone else. Therefore, readers can assume it is a village, not an industrialized city.
No technology is referenced in the piece, and a stoning takes place in the end. These features can both lead readers to assume a time well before technology reigned and when human rights were not granted for all.
The purposeful omission of a stated time or place suggests that the events in "The Lottery" can occur for any society at any time. The link below provides further information regarding setting.