Answer
John 9:31 declares, “We know that God does not listen to sinners. He listens to the godly man who does his will.” It has also been said that “the only prayer that God hears from a sinner is the prayer for salvation.” As a result, some believe that God does not hear and/or will never answer the prayers of an unbeliever. In context, though, John 9:31 is saying that God does not perform miracles through an unbeliever. First John 5:14-15 tells us that God answers prayers based on whether they are asked according to His will. This principle, perhaps, applies to unbelievers. If an unbeliever asks a prayer of God that is according to His will, nothing prevents God from answering such a prayer—according to His will.
Some Scriptures describe God hearing and answering the prayers of unbelievers. In most of these cases, prayer was involved. In one or two, God responded to the cry of the heart (it is not stated whether that cry was directed toward God). In some of these cases, the prayer seems to be combined with repentance. But in other cases, the prayer was simply for an earthly need or blessing, and God responded either out of compassion or in response to the genuine seeking or the faith of the person. Here are some passages dealing with prayer by an unbeliever:
The people of Nineveh prayed that Nineveh might be spared (Jonah 3:5-10). God answered this prayer and did not destroy the city of Nineveh as He had threatened.
Hagar asked God to protect her son Ishmael (Genesis 21:14-19). God not only protected Ishmael, God blessed him exceedingly.
In 1 Kings 21:17-29, especially verses 27-29, Ahab fasts and mourns over Elijah’s prophecy concerning his posterity. God responds by not bringing about the calamity in Ahab’s time.
The Gentile woman from the Tyre and Sidon area prayed that Jesus would deliver her daughter from a demon (Mark 7:24-30). Jesus cast the demon out of the woman’s daughter.
Cornelius, the Roman centurion in Acts 10, had the apostle Peter sent to him in response to Cornelius being a righteous man. Acts 10:2 tells us that Cornelius “prayed to God regularly.”
God does make promises that are applicable to all (saved and unsaved alike) such as Jeremiah 29:13: “You will seek me and find me when you seek me with all your heart.” This was the case for Cornelius in Acts 10:1-6. But there are many promises that, according to the context of the passages, are for Christians alone. Because Christians have received Jesus as the Savior, they are encouraged to come boldly to the throne of grace to find help in time of need (Hebrews 4:14-16). We are told that when we ask for anything according to God’s will, He hears and gives us what we ask for (1 John 5:14-15). There are many other promises for Christians concerning prayer (Matthew 21:22; John 14:13, 15:7). So, yes, there are instances in which God does not answer the prayers of an unbeliever. At the same time, in His grace and mercy, God can intervene in the lives of unbelievers in response to their prayers.