When Wells's mother worked as a housekeeper at Uppark, her quarters were in the basement. Might this have influenced Wells's ideas about subterranean living? (source).
The fourth dimension (and beyond) wasn't a totally new concept for Wells's readers. Some scientists had discussed it, like C. H. Hinton in his essay "What is the Fourth Dimension?" (1884). Some interesting fiction had also explored the notion of dimensions, like Edwin A. Abbott's Flatland (1884). Flatland is interesting, we think, because it asks questions like: what would a sphere moving through a two-dimensional world look like to its inhabitants? The answer: they would see the sphere as a series of events. This is kind of like how the Time Traveller describes the aging process: what we see when we look at a person at a given age is merely a cross section of the whole person; all of these cross sections together make up the person in the fourth dimension.
Another notable work about people living underground is Edward Bulwer-Lytton's The Coming Race (1871), which was about someone falling into a deep mine and discovering an incredible civilization under the earth. This civilization, called the Vril-ya, is enormously advanced and powerful, very different from the Morlocks. But there's still a sense of threat there – the Vril-ya are, after all, the "coming race."
Wells's speculation about the future is not limited to The Time Machine. He wrote several nonfiction works of futurism, like Anticipations and The Future in America. These were immensely popular, and for a time they somewhat eclipsed his novels.
The idea of Morlocks and Eloi has been used by other writers interested in social segregation. Fairly recently science fiction author Neal Stephenson wrote a collection of essays titled In the Beginning was the Command Line, in which he suggests that the Morlocks of the world today are those who understand how things actually work – the computer engineers and programmers. While the Time Traveller seems to sympathize more with the Eloi, Stephenson praises the Morlocks for their technical skills.