Can the funeral prayer be offered for one who did not pray?
Attending the funeral of a Muslim, i.e., washing him or shrouding him or offering the prayer for him or burying him, is a communal obligation; if there is someone among the Muslims who can do that, then it becomes mustahabb for you and not obligatory.
It says in Zaad al-Mustaqni’: Washing the deceased, shrouding him, offering the prayer for him and burying him is a communal obligation (fard kifaayah).
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said in al-Sharh: It should be noted that with regard to every communal obligation, if it is undertaken by one who can do it properly, it is waived in the case of the others, but if there is only one person who can do it, then in his case it becomes an individual obligation (fard ‘ayn).
The author says “burying him is a communal obligation”, and that on which burial depends is also a communal obligation, and that on which the prayer depends is also a communal obligation, thus carrying him from his house to the prayer place is a communal obligation, and carrying him from the prayer place to the graveyard is a communal obligation, because that without which the obligatory duty cannot be done is also obligatory. End quote from al-Sharh al-Mumti’, 5/265.
With regard to the one who does not pray, if he does not pray at all he is a kaafir, whether he does not pray because of laziness or because he denies that it is obligatory, according to the more correct of the two scholarly opinions, because of a great deal of evidence, some of which has been mentioned in the answer to question number 5208 and 83165.
Based on that, it is not permissible for you to offer the funeral prayer for one who you know died not praying, because of the general meaning of the verses in which Allaah says (interpretation of the meaning):“And never (O Muhammad صلى الله عليه وسلم) pray (funeral prayer) for any of them (hypocrites) who dies, nor stand at his grave. Certainly they disbelieved in Allaah and His Messenger, and died while they were Faasiqoon (rebellious, — disobedient to Allaah and His Messenger صلى الله عليه وسلم)”
“It is not (proper) for the Prophet and those who believe to ask Allaah’s forgiveness for the Mushrikoon, even though they be of kin, after it has become clear to them that they are the dwellers of the Fire (because they died in a state of disbelief)”
So the one who did not pray should not be washed or shrouded or the prayer offered for him, and he should not be buried in the Muslim graveyard, because he is a kaafir, as stated above.
As for the disobedient Muslim, such as the one who used to drink alcohol but he prayed regularly and did not stop praying, the funeral prayer should be offered for him, but the imam or scholar may refrain from offering the funeral prayer for him, as a rebuke to deter people from doing what he did and to scare those who are like him, but other people should offer the funeral prayer for him.
And Allaah knows best.