One of the strangest things about the book of Job is how the three “friends” (Eliphaz, Bildad, and Zophar) are restored to Job and to God. It is very round-about and teaches us surprising lessons about prayer.
After the LORD had spoken these words to Job, the LORD said to Eliphaz the Temanite: “My anger burns against you and against your two friends, for you have not spoken of me what is right, as my servant Job has. Now therefore take seven bulls and seven rams and go to my servant Job and offer up a burnt offering for yourselves. And my servant Job shall pray for you, for I will accept his prayer not to deal with you according to your folly.” (Job 42:7-8)
In verse 7 God says that his wrath is kindled against Eliphaz and his two friends “for you have not spoken of me what is right.” How then shall they be restored to God's fellowship and escape his wrath?
God says that they must ask Job to pray for them as they offer up for themselves a burnt offering, “for I will accept his prayer not to deal with you according to your folly.” So they do this. “And the Lord accepted Job's prayer” (v. 9).
All of this happened not just for the three friends’ sake, but for Job’s. When he had prayed for them, everything changed for him. "The Lord restored the fortunes of Job, when he had prayed for his friends" (v. 10).
So it appears that the condition for Job's friends to be restored to God was Job's forgiving intercession for them. And it appears also that the condition for God's restoring Job's fortunes was the same.
It is remarkable that God would not simply accept the repentant prayers of these three friends for themselves. They had to get Job to pray for them. God would hear Job's prayer not theirs.
Perhaps the reason for this is that it is God's way of demanding (along the lines of Matt. 5:18-23) that there be reconciliation before there be acceptance of worship and forgiveness.
The Lord's prayer says, "Forgive us our sins as we forgive those who sin against us." Job needed forgiveness. He also needed to forgive. His enemies also needed God’s forgiveness. So God brought them to Job, seeking his intercession on their behalf, and that is exactly the kind of love Jesus commands—“pray for those who persecute you.”
And the three friends needed to seek forgiveness from Job before their prayers could be heard because Job's animosity toward them was their fault in large measure. If your brother has anything against you, go and be reconciled to your brother.
But the text does not say that God will hear their prayers when they patch things up with Job. It says that Job's prayer for them will be heard. So the dynamic here is not simply human forgiveness opening the way for the three to be heard in heaven. The dynamic is that God ordains that the prayers of some people will be received for the guilt of others.
Part of the reconciling process is the vertical intervention of Job on behalf of the three adversaries, not just the horizontal reconciliation with them. The prayer of Job for these three was essential for God not to "deal with them according to their folly."
What we learn is that God wills to do some things in answer to prayer that he wants to do, but will not otherwise do. And we should be diligent to pray for others whose prayers for themselves may not be accepted for reasons we do not know. It means we may be the appointed means of someone escaping the consequences of their folly, which they may be able to escape in no other way.