James explores healing through prayer and anointing. What he urges, and here we clearly hear resonances of faith in James 1:6-8, is to pray in faith — to pray trusting that God can heal and that God will heal.
Here are James’ words:
And the prayer offered in faith will make them well; the Lord will raise them up. If they have sinned, they will be forgiven. Therefore confess your sins to each other and pray for each other so
that you may be healed. The prayer of a righteous person is powerful
and effective.Elijah was a human being, even as we are. He prayed earnestly that it
would not rain, and it did not rain on the land for three and a half
years. Again he prayed, and the heavens gave rain, and the earth produced its crops.
To be sure, there is some wandering from one idea to another in this text, but it coheres: pray in faith and that raises that some sickness comes from sin and so confession is important. But the person must ask in faith, like Elijah.
Some struggle with this: people closer to God have more prayers answered. I believe that, not just because it is in the Bible, but from experience with the folks in the church who are devoted and who pray and who are known for God hearing their prayers. There’s no one-to-one correlation, and that’s the hitch: godly people have unanswered prayers and some scoundrels have their prayers answered. But the point for James is clear: if you want God to hear your prayer for healing and forgiveness, then (1) you will have to trust God and (2) you will have to have a heart turned toward God. I don’t think he’s offering magical solutions or inevitable formulae.