Donating parts of the body to another person to benefit from them is an act of charity and good deeds for which a Muslim would be rewarded (And whoever saves one (soul) is as if he had saved mankind entirely…) Q5: 32; whether the donation was in his lifetime after fulfilling all the conditions, or after his death in case of accidents, or after the accident if he had willed to do so.

As for donating some parts of the body for scientific research, it is permissible on the condition that there is a body to be buried. This is because sharia requires to bury a body in order to take care of the sanctity. Per contra, it is not permissible to donate the entire body for scientific research. This is contrary to the sanctity of the dead, and Islam has advocated for the sanctity of the human body, alive or dead.