Funeral Prayer following the execution of a Had or Qisas
Offering Funeral Prayer for someone who apparently dies a Muslim is a collective obligation, even if they have committed a major sin other than Shirk (associating others with Allah in His Divinity or worship). Anyone executed by the infliction of Qisas or the stoning penalty for adultery should have the Funeral Prayer performed for them.
The correct opinion of the scholars is that the Had do expiate for the sins that they have been carried out for, according to the Hadith reported on the authority of
`Ubadah ibn Al-Samit (may Allah be pleased with him) who narrated that the Prophet (peace be upon him) said to his Sahabah (Companions):
Pledge allegiance to me that you will not associate anything with Allah, that you will not commit Zina (sexual intercourse outside marriage), that you will not steal, that you will not kill the soul which Allah has forbidden (to be killed) except by (legal) right. Anyone among you who fulfills (this pledge), his reward is due from Allah. Anyone among you who commits anything of this and is punished for it in this world, it will be his expiation for it. Anyone among you who commits anything of this and Allah shields him (i.e. Covers his sin), then his matter will rest with Allah: if He so wills, He will pardon him; and if He so wills, He will punish him.
(Part No. 8; Page No. 415)
May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.