Islam certainly allows its adherents to pray for their non-Muslim relatives and friends who are still living. We can pray Allah for a non-Muslim to guide him or to have a good health to succeed in an exam. However, it is not permissible to pray for dead persons if we are certain that they died in disbelief.
Elaborating on this issue, Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states: “We are certainly allowed to make du`a’ for our non-Muslim relatives and friends who are living; we can pray for them for their health, wellbeing and guidance. But the most important prayer that we can do for them is to pray for their guidance to the path of Islam; we must do so on a continuous basis. Our prayer for guidance for them should be complemented by our earnest efforts to persuade them to embrace Islam through wisdom and beautiful preaching. The Prophet (peace and blessings be upon him) said, “If a single person were to be guided to the right way through your efforts that would be better for you than owning the whole world as a treasure!”
As for our non-Muslim relatives or friends who have died, we are not allowed to pray for them if we know for a certain fact that they have died in disbelief:
Allah says, “It is not fitting for the Prophet and the believers to pray for the forgiveness of the polytheists, even though they may be near kin (to them) after it has become clear them that they are the people of Hell.” (At-Tawbah: 113)
Since, according to Islam, every person is responsible for the choice he has made in life, and he has chosen the path of disbelief, we are not to pray for his forgiveness. If, however, we are not sure what kind of faith they died in, then we are allowed to offer the following general prayer which includes all believers. If they had died in faith they would certainly be included in it; let Allah be the judge:
Allahumma ighfir li al-mu’minia wa al-mu’minat, al-ahya’ minhum wa al-amwat: (O Allah, forgive all believers, males and females, those who are living and those who have died).
We may also pray in the manner of Prophet `Isa (Jesus—peace be upon him), who prayed to Allah concerning the Christians who associated him in the worship of Allah:
“If you punish them, they are Your slaves, and if You forgive them, You are the August, the Wise.” (Al-Ma’idah: 118)”