This is a good question. While the novel does not give an explicit reason for why Ralph is made the leader, we can make a few educated guesses. First, we can say that Ralph is the first one who shows leadership qualities. We can see this when he urges people to build huts and the like, while the other boys are simply playing.
Second, we can say that Ralph is also the one with the best ideas. For example, it is his idea to make a fire, so that ships that pass by can rescue them.
In short, Ralph shows leadership skills and so they elect him to be the natural leader.