Everyone sent to the ISS is (to the best of our ability to determine) in peak physical condition, so the odds of something going catastrophically wrong are very low. However, if it does, everyone on the station has basic medical training, and there is a capsule that they can put people in and send them back to Earth in an emergency.
Astronauts are taught quite advanced first aid. So they are trained to recognize a lot of symptoms and treat a number of things, including administering drugs. There is a quite healthy first aid kit on ISS which includes a number of different drugs which are typically used in first aid. In addition to this there is a flight surgeon for each expedition who is a professional medical doctor. Usually the flight surgeon is part of the crew but that is not a strict rule. So you have a doctor, drugs and a trained crew, the best situation you could have.
In addition to giving first aid the procedure is to get the ill astronaut into their return capsule, with the rest of the crew of that capsule, and then land as soon as possible. Once they close the hatch on the capsule it may take as little as 10 minutes before they land. But it is not that simple as they can not land anywhere. There is a number of sites which have been evaluated beforehand, spread all over the world. Usually deserted areas so they do not crash into anything but close enough to settlements for ambulance helicopters to quickly get to the landing site in time. They will pick one of these sites to land on depending on their orbit. It takes roughly 90 minutes for the ISS to orbit the planet once, but they might have multiple potential landing sites in each orbit. But they might get unlucky and for example miss their landing site in China so they have to land in Argentina instead which would be another 40 minute wait to cross the Pacific ocean.
People who get sent to space are in excellent physical condition. The likelihood that they suffer from a heart attack or something else like that is very low.
They also have some level of medical training before going up. They’re obviously not as trained as a full doctor, but they’re above a typical First Aid class. They also have doctors on staff on the ground who not only monitor the astronauts remotely but are also able to guide them through an emergency event.
There’s also special training for stuff like CPR in space, where being in zero G affects how it is done compared to on Earth.
Aside from the treatment they can provide on the station, itself, they can have someone in a hospital on the ground in a couple of hours, max, if need be. The ISS orbits the Earth every 90 minutes, give or take a minute or two, and an emergency re-entry only takes a half-hour or so. There’s always at least one capsule docked at the station, so worst-case scenario NASA calculates where and when to undock the capsule, orient for re-entry, and the timing and duration of the retro-burn. They’ll then know within a couple of square miles where the capsule is going to come down (they can’t *quite* put it in a swimming pool, but they can certainly drop it in a lake if they have to), and have emergency medical services ready to swoop in and fly the patient to the nearest hospital. Depending on how much fuel the capsule has to burn, they can almost ensure the astronaut goes to any hospital in the world.
They’ve never *had* to do it, but you can bet they’re ready to do so if they need to.
I would assume aside from always having a doctor on the crew they would also have ground personnel at the ready to walk the astronauts through who would also have had some training on earth. and they only pick people who are in very good shape shape as well as not being 50+ so the likelihood of a heart attack is basically zero
Latest Answers