I think this is extraordinarily unlikely, indeed for all practical purposes, impossible. Humans without tools would go extinct easily. How many great apes do you find in the Arctic or the Kalahari desert? But with only stone age technology, we could survive almost anywhere. We are omnivores too, able to survive to adulthood on almost any diet. With some diets we might not live so long, but it’s hard to think of any situation where humans couldn’t grow to maturity somewhere on the Earth.
There’s no plausible disaster that could make Earth so uninhabitable that humans can’t survive by eating roots, shellfish, fruit, or one way or another. The usual culprit here is a giant asteroid impact. But turtles, dawn sequoia, bird, small mammals, fish, crocodiles all survived the Chixculub impact. We surely would also.
Also, that’s the worst that we can get. In the early solar system Earth was hit by many 100 km and larger asteroids but this stopped more than three billion years ago as the solar system settled down,as we can see from the cratering record of the inner solar system. Jupiter apparently protects us from the very largest asteroids.
And what’s more, we have the capability to detect the asteroid long in advance and deflect it. Far better to spend a few hundred million dollars, or even a few billion dollars (to do it really quickly) on capable space telescopes to speed up our searches for damaging asteroids than to spend probably trillions on trying to colonize another planet. See Giant Asteroid Headed Your Way? - How We Can Detect And Deflect Them
As another example, a gamma ray burst is very rare, exceedingly unlikely to happen this century. But it also wouldn’t make us extinct. Only the side of Earth facing towards the burst would experience the immediate effects and even on that side you’d escape the effects if deep underground in a mine, or in a submarine. And afterwards the destruction of the ozone layer is certainly something humans with our technology could survive. Many other species also but certainly humans. We may have been through them several times in the past and if so obviously many species survived.
Climate change also wouldn’t make us extinct. It’s potentially devastating, yes, if we don’t stop it. But the worst case scenario is flooding of many low lying places like Bangladesh, losing many islands in the Pacific, changes in weather patterns so that many species can no longer survive where they lived before, and very slightly acidic oceans so there’s no coral any more (only affects things that are very sensitive to small amounts of acid), things like that.
I totally agree we shouldn’t let that happen. It could be disastrous for us. But disastrous though they are, those are not human extinction events. I think the pessimistic predictions are based around treating humans as if we were a typical species on Earth when we are one of the most adaptable especially with technology, and because we are already omnivores able to survive almost in any land habitat and also floating on lakes and fishing in the sea.
For other suggested disasters, see my Could Anything Make Humans Extinct In The Near Future?
And whether we like it or not, the Earth is still by far the most habitable place in our solar system. Even after the worst of natural disasters, it will remain so. As for human created disasters, these also can’t make Earth as hostile to humans as Mars, even our best attempt at a terraformed Mars if that is possible at all (even the optimists agree it would take thousands of years, outside of science fiction of course).
And if it is our technology that’s the problem, the problems are as likely to start on Mars as anywhere, if we attempt a colony there - the most high technology attempt at a colony ever made. For instance they would be amongst the most likely to try to make replicating machines or synthetic life, they might return extraterrestrial life from Mars to Earth, and with accelerated colonization with millions in space there’s also the possibility of wars between space colonies and Earth.
If you think Mars would be protected by a kind of six month quarantine because it takes so long to get there, remember that we have ideas for propulsion methods that could get us there in weeks possibly even days. Also we could set up a permanently quarantined colony on Earth easily enough for far less cost than a Mars colony.
And - I don't actually think we will lose all our technology on Earth, I think looking at past history that even when civilizations end, the technology doesn't vanish completely. Since the iron age, the world never lost the ability to smelt iron even though many small tribes can't do it. It never lost writing after it was invented. It never lost simple maths ideas like how to count, addition etc.
As it is now, I think we will never lose the place notation, fractions (quite a late development in maths), zero, and very very unlikely to lose algebra or calculus. Only a certain percentage can differentiate or integrate, but you don't need everyone to be able to do it to have a few teachers to pass it on to the next generation.
In medicine, we won't forget anesthetic, the microbe theory of diseases, the need for surgeons to wash their hands before surgery and nurses to keep clean, or vaccination,
I don't think we'll lose the ability to build airplanes either. Or bicycles. Both are easy to do with a small amount of technology and mainly based on knowing it is possible and if we have engineering - even if we forgot most of it, we can reinvent it quickly, or learn it from books, so long as a few engineering books survive from our era.
I think there might be a place for a “backup” in space, but it's Earth that you'd want to restore with any backup of seeds, technology, and knowledge, making the Moon, or Earth itself, the ideal places to keep these repositories. And if we do send humans to Mars, why not study it telerobotically from its moons or from orbit first? Why risk a human crash in the one place in the inner solar system most vulnerable to Earth microbes?
The Moon is so close that it's going to be easy to scout out with robots controlled in near to real time from Earth. Later on, we can use them again to get our lunar villageready, with the habitats, utilities and landing pad all in place, before our astronauts arrive. On Mars a new idea that goes wrong could quickly lead to death of the entire crew. On the Moon, we can get help in days, or in the worst case, the crew can bail out back to Earth in their "lifeboats", and then start again, with no need to wait for two years for the next opportunity. And surprisingly perhaps, the Moon has many advantages over Mars as a place to live too.
See also: my comment about what might happen in the far future
This answer uses extracts from my Case For Moon First book (which is available to read online in its entirety for free and also available for purchase from Kindle). It goes into these issues in a lot more detail as well.
This answer uses material particularly from the Preface and the sections:
See also Robert Walker's answer to Are humans destined to colonize the universe?