The person who dies and he did not pray, Hajj is not performed on his behalf
Question:
I have a relative who died during the month of Ramadhan and before his death he was lax about offering the prayer and paying Az-Zakah. He never performed Hajj during his lifetime. Is it permissible to perform Hajj on his behalf, and likewise, to pay Az-Zakah (for him)?
Answer:
If he used to pray sometimes and abandon the prayer sometimes, then Hajj should not be performed on his behalf and Az-Zakah should not be paid for him. His Muslim relatives do not inherit from him. Rather, whatever he left behind is for the public treasury of the Muslims. This is because abandoning the prayer is major disbelief, due to the Prophetýs statement: The covenant that is (a separation) between us and them is the prayer, so whoever abandons it, then he has disbelieved. This was recorded by Imam Ahmed and the Sunan compilers with an authentic chain of narration. This is also due to the Prophetýs statement: Between the man and disbelief and associating partners with Allah is abandoning the prayer. This is recorded by Muslim in his sahih. This point is also based on other evidences from the Book and Sunnah that prove what we have mentioned. We ask Allah to correct the situations of the Muslims and to help them guard the observance of the prayers and be devout in their performance. We also ask Him to help them to avoid the things that lead to their abandonment. Verily, He is Most Generous, Most Noble.
Source:
Shaykh `Abdul-`Azeez Bin Baz
Fatawa Islamiyah Darussalam Vol: 4 p 53