The first reason the boys build a fire is to serve as a signal for passing ships to see that there are boys on the uninhabited island that need to be rescued. The boys decide to build the signal fire on the top of the mountain and Ralph puts Jack and his hunters in charge of maintaining the signal fire throughout the day and night. However, Jack excuses Samneric from their duties watching the signal fire and the boys miss out on an opportunity to be rescued when a ship passes the island.
The second reason the boys use fire is to cook the pig meat. After Jack and his hunters kill their first pig, they build a fire to roast the pig meat. When Jack establishes his own tribe of savages on the opposite end of the island, Ralph and Piggy start their own fire to keep them warm and calm the littluns during the night. Jack also uses fire in an attempt to smoke Ralph out of the forest toward the end of the novel. When Jack and his band of savages hunt Ralph, they set the forest on fire, which forces Ralph to run onto the beach to escape the burning forest.