The novel was written by British author William Golding (1911-1993).
His exposure to the atrocities of World War 2 altered his view of mankind. He no longer viewed humanity as innocent and noble, but believed that when a person is forced into extreme situations, the darker, more sinful side of human nature surfaces.
Lord of the Flies was first published in 1954.
William Golding does not reveal exactly where or when the novel is set, but it's likely set in World War 2. During World War 2 (1939-1945), the Nazi’s bombed Britain every night (‘the Blitz’). To save lives, children were relocated to the rural areas (or even to other countries) while the parents stayed behind.
Some commentators have suggested that the story is set after World War 2, during some imaginary nuclear war. This is based on Piggy's statement that he heard talk on the radio about a nuclear attack. (However, America ended World War 2 by dropping two nuclear bombs on Japan, so it could still refer to World War 2.)