This is a matter of difference among scholars and some prohibit the use corposes for scientific research. But According to a fatwa by the Qatari Fatwa Authority, donating one’s body to be used for scientific research is permitted since it fulfills a good purpose and is not opposed to any of the fundamental precepts of the Sharia.
The scholar Gad al-Haq Ali (of al-Azhar University) permitted using the bodies of certain corpses (those who are found dead by government agencies and their identity cannot be established, and those whose identity is known but have no known relatives) for scientific research as it is practiced by some countries.
However, as mentioned here a different ruling prohibits donating the organs of dead people without their having expressed their consent while alive, therefore the person must have expressed their to consent to the use of their body in this way while alive.
- Fatwa from the Qatari Fatwa Authority (Arabic PDF)
- Source of Gad al-Haq Ali’s fatwa (Arabic PDF)