Weren't Wells and Verne writing SF in the 19th Century? Didn't the 19th and Early 20th Century give us things like locomotives, automobiles, airplanes, the telegraph, radio and the telephone?
I don't see why SF would not exist in Star Trek's time frame. There will always be speculation about new science and technology and its impact on society. The local might shift as the fictional heroes travel to other galaxies instead of other planets.