Currently, humans only spend relatively short periods of time in space and that time is spent close to Earth. If an astronaut passes away in space, his or her body can be transported back to Earth soon.
What about planned journeys to Mars? Not only do they take longer to get there, but there are plans to have humans living there permanently. Consequently, NASA must come up with a plan to deal with any astronaut deaths.
Recently, Yahoo discussed some possible plans in an article titled "Here's what NASA plans to do if an astronaut dies in space."
The simplest solution? Jettison a dead body into the vacuum of space. Kind of like burial at sea for sailors. However, that is prohibited by international agreement.
So, here is the proposed solution. If an astronaut dies while in route to Mars, NASA plans to put the body in a special bag that can be exposed to outer space. The body would freeze and be brought back into the spacecraft where it would be vibrated thereby causing the remains to be ground into a fine dust.
What happens to the “dust”? If someone dies while on Mars, NASA is discussing using the remains as compost for the crops settlers would grow.
Of course, human settlers on Mars would also have estate planning issues that need to be worked out, especially if they want to leave property on Mars to a relative living on Earth.
Needless to say, that is yet another difficult problem that NASA will need to work out.
Reference: Yahoo (April 10, 2015) "Here's what NASA plans to do if an astronaut dies in space."