Necrophelia is apparently permitted and may even be encouraged in Islam.
Historical note from Wikipedia: Singular accounts of necrophilia in history are sporadic, though written records suggest the practice was present within Ancient Egypt. Herodotus writes in The Histories that, to discourage intercourse with a corpse, ancient Egyptians left deceased beautiful women to decay for “three or four days” before giving them to the embalmers. So there may be precedence here that dates into antiquity?
Egyptian husbands will soon be legally allowed to have sex with their dead wives – for up to six hours after their death. The controversial new law is part of a raft of measures being introduced by the Islamist-dominated parliament. It will also see the minimum age of marriage lowered to 14 and the ridding of women’s rights of getting education and employment.
The story continues: “The subject of a husband having sex with his dead wife arose in May 2011 when Moroccan cleric Zamzami Abdul Bari said marriage remains valid even after death. He also said that women have the right to have sex with her dead husband, alarabiya.net reported.