Fiqh-us-Sunnah Volume 3, Zakaat and Fasting, Fiqh 3.075B.

Section : The Distribution of Zakah in Order to Grow Nearer to Allah.

It is not permissible to distribute zakah so as to grow nearer to Allah other than what Allah, the Exalted One, mentions in the ‘ayah: “The alms are only for the poor and the needy” (at-Taubah 60). Thus, zakah cannot be paid for establishing mosques, bridges, road repair, hospitality, shrouding the dead, and so on. Abu Dawud witnesses: “I heard Ahmad while he was asked whether spending part of the zakah on shrouding the deceased was permissible. He said: ‘No. Nor can it be used to pay the debt of the dead.'” He also said: “One can pay the debt of a living person from the zakah but not that of the deceased. For a person who dies, there is no debt.”

Ahmad was also asked what would happen if it had been given to help them redeem their debt. He answered: “Yes, for his family it is all right.”