It would depend on the mission and other things.
If the astronaut died on a shuttle mission, the mission would likely be aborted, and the shuttle would return home as quickly as possible. The body would be handled respectfully, probably wrapped in an air tight bag and strapped into a seat for landing.
If the astronaut died on the space station, it would take longer to deal with. The space station maintains a soyuz capsule for emergency evacuation of the crew, but I doubt this would be used except as a last resort. If the next crew rotation were not too long off, the body would probably be similarly stowed in an air tight bag, and return to Earth on the next crew change. If the rotation is far enough away, a special mission, soyuz or shuttle would probably be scheduled. They would try to include supplies and other items from future missions to lessen the impact of the change in schedule.
If the astronaut died on the way to Mars or the Moon, the body would probably have to be stowed for the duration of the mission. Serious consideration would have to be given to jettisoning the body, since space on the craft would probably be too cramped to store the body.
NASA has definitely considered the possibility and worked out procedures for the worst case scenario, but you are right. As healthy as these astronauts are, the chance of this happening is very small.
I hope this helps.