Global economic collapse due to an asteroid or nuclear war might not cause human extinction but it would mean a very large regression in our technological capacity. That could endure for hundreds if not thousands of years. Maybe we would never fully recover, people argue that point based on all of the easy to access resources having already been exploited though I have more faith in humanity's ingenuity. The role of a Mars colony in this scenario isn't to send iron ore to Earth, it's to maintain high technology and continue moving forward.
The risk of a pandemic becoming interplanetary is much lower than the risk of international spread. Travel between Earth and Mars is necessarily constrained by their orbits with a window opening only every 26 months. Most travel would likely be uncrewed cargo and when people do make the trip there would be strict quarantine measures taken (this is already done with current crewed launches to orbit and there is established history of immigration being subject to quarantine). Most importantly, the trip to Mars takes much longer than the incubation period of any disease likely to cause a pandemic so the disease will have run its course by the time the ship reaches Mars and they can decide what to do at that point (at the extreme they may resupply it and send it back but that's probably not necessary in most cases).