Contrary to popular belief, Jewish law does not have an absolute prohibition on this post-death procedure.

This article provides an Orthodox view on autopsy. Conservative authorities follow similar reasoning, rejecting routine autopsies, but some permit them in individual situations where constructive knowledge may be gained. The Reform movement has two 20th-century responsa on this subject: The first (in 1925) takes the position that construing autopsy as desecration of a corpse has no basis in classical Jewish sources, and that even the chance of contributing to life-saving medical knowledge justifies performing one. The second (in 1981) argues that even gaining knowledge that may help others in years ahead is sufficient justification.
Respect for the Dead, Keeping the Body Intact
The Jewish belief in the inviolability of the human body is reflected in its attitude to postmortem examinations. The Talmud (Sanhedrin 47a) asserts that the biblical imperative of speedy burial (Deuteronomy 21:22-23) is based upon the prohibition of disgracing a corpse. The scope of this prohibition extends beyond delayed burial. Scripture proscribes the inflicting of any form of disgrace upon a corpse. In general, this includes the disfigurement of the body as a result of postmortem dissection (autopsy).
Apart from the general prohibition against autopsies, which derives from our abhorrence of bodily disfigurement, there is a special prohibition against failure to bury the body in its entirety. If, after autopsy, for example, part of the body is excised and not buried, [according to one source] it is as if no burial at all took place (Jerusalem Talmud, Nazir 7:1).
Exception for Life-Saving Procedures
The prohibition against the performance of autopsies, however, is not absolute. An exception is made if the autopsy may directly contribute to saving the life of another patient who is currently awaiting treatment. Owing to the speed of contemporary communications, a sufferer elsewhere in the world may be aided almost immediately. Moreover, if the presence of a contagious disease, not diagnosed before death, is suspected, an autopsy may lead to the prevention of a plague. If new medicines were used on the patient, an autopsy can help to determine their life-saving effectiveness. It goes without saying that if a hereditary disease is the suspected cause of death, an autopsy may prevent the deaths of the patient’s children, by establishing a preventative medical strategy for them.
Obviously, if postmortem needle biopsies or blood samples or peritoneoscopy would suffice, autopsies should not be performed at all.
However, when an autopsy is necessary, permission to undertake this procedure should be given only if the operation is reduced to a minimum, performed as soon as possible–and in the presence of a rabbi or observant and halakhically (having to do with Jewish law) knowledgeable physician — and undertaken with reverence. There must be absolute assurance that all parts of the body will be retained for burial.
Because, however, the frequency of autopsies has increased, the danger exists of their becoming mere routine; and because recent studies (particularly the Journal of the American Medical Association, vol.233, 1975, pp. 441-443) have shown the questionable medical value of routine performance of postmortem dissections, permission should be withheld unless a physician who is sensitive to the halakhah [Jewish law] advises its performance in terms of the criteria for saving life which have been listed above.
The Man Who Buried His Own Leg – YouTub
As taken from, Autopsies and Jewish Law: An Orthodox Perspective | My Jewish Learning