In his attempt to address this issue, Dr. `Abdul-Fattah `Ashoor, professor of Qur’anic exegesis and its sciences, said:
Clear prophetic injunctions tell us that Allah does not accept or answer the prayers of those Muslims who consume others’ wealth with unlawful means and whose earnings are not lawful. If this is the case for such Muslims, then the prayers of those who originally disbelieve in Allah are more deserving of not being answered.
However, in times of necessity and urgent need, a disbeliever sometimes resorts to his true Lord seeking His help by praying sincerely to Him to save him from his hardship. In this case, Allah may answer his prayer because he sincerely prays to him. Allah says:
“He it is Who makes you travel by land and sea; until when you are in the ships, and they sail on with them in a pleasant breeze, and they rejoice, a violent wind overtakes them and the billows surge in on them from all sides, and they become certain that they are encompassed about, they pray to Allah, being sincere to Him in obedience: If You should deliver us from this, we will most certainly be of the grateful ones. But when He delivers them, behold! They transgress insolently through the earth in defiance of right!…” (Yunus 10:22-23)