All perfect praise be to Allaah, The Lord of the worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and messenger.
The majority of jurists considers the deceased who died in a state of Janaabah (i.e. ritual state of impurity) to be washed only once, which is the Ghusl due to death. He is not to be washed again due to his state of Janaabah. This is because all rulings are lifted from him at the time of his death and all obligations are dropped.
Ibn Qudaamah said in Al-Mughni: “If a menstruating woman or someone in a state of Janaabah dies, they are treated as others regarding Ghusl. Ibn Al-Munthir said: “This is the opinion we have learned from the scholars of the major locales." […] It is reported from Al-Hasan Al-Basri that he would wash a deceased due to Janaabah and a menstruating woman due to her menses and then he would wash them again due to their death. However, the first opinion is more appropriate because they (i.e. the two types of people) are exempt from all duties and no act of worship remains an obligation on them. The only worshipful act that is left is the Ghusl of the deceased in order that he leaves the world in the best state of cleanliness and freshness. This can be done with a single Ghusl. Furthermore, a single Ghusl is sufficient for one who is obliged to perform Ghusl for both reasons, meaning if a woman was both in a state of Janaabah and finished her menses.”
Allaah Knows best.