There is a suggestion in this story that by having the lottery each year, a human sacrifice to unseen forces in the universe or gods, that the survival of the town is assured for another year. This is only hinted at, since no one can remember why they have the lottery anymore, only that it is tradition.
In fact, the older members of the town, like Old Man Warner, directly links the bounty or plentifulness of the crops with the holding of the lottery. That is why he is shocked when someone suggests that other towns have abandoned the lottery.
The lottery is held to please the gods, so that they will allow for a bountiful harvest, which is observed as on its way in June.