In the event of the death of any of the crew members, his body must be brought home: immediately or after the end of the mission, it is decided depending on the situation. This is a hypothetical answer – fortunately, such situations have not happened yet. The fact is that the health of astronauts is very, very monitored. Several times a week, astronauts get in direct contact with their doctors, in conversation with whom they can discuss all the existing health problems.
In addition, astronauts undergo a very serious medical examination before the flight and at the slightest suspicion they are excommunicated from the mission.