H.G. Wells, as were other science fiction writers, was influenced by astronomical discoveries of the 19th Century. Of these, the most influential in terms of Wells' The War of the Worlds was Giovanni Schiaparelli's identification of channels on the Martian surface in 1877. The Italian word Schiaparelli used to described the linear formations he identified was "canali," which translates as "channels." In America, however, the use of the word "canali" was misinterpreted as "canals," and the legend began.
Because of Mars' proximity to Earth, the little that was known about the surface of Venus, and the belief among many people that there had to be, or once was life on Mars, it didn't take much for creative authors like Wells to turn the discovery into a plot device. The contributions in the 1890s to the debate about life on Mars, and the significance of the channels, by Percival Lowell, an American astronomer, fed into public perceptions of Mars as the home to a species of alien that could pose a threat to Earth.
Wells, of course, wasn't alone in exploiting popular misconceptions about Mars in the interest of science fiction. Ray Bradbury's The Martian Chronicles would play on much the same themes almost half-a-century later.