“Is anyone among you sick? Let him call for the elders of the church, and let them pray over him, anointing him with oil in the name of the Lord.“
anointing him with oil
The question here is whether “anointing” refers to a ceremonial anointing or simply the medicinal application of oil. At first glance, this passage appears to teach that the elders can physically heal sick believers, but this is inconsistent with the context. The context deals with believers under persecution. This person is physically sick because of his sin.
James uses the more basic term “rub with oil,“ not the term for ceremonial anointing. Our word in this verse is the ordinary word, not the ceremonial word for anointing. In the first century, people commonly applied oil to the sick. However, it is not anointing, but prayer that heals the sick.
in the name of the Lord
Spiritual leadership ministers “in the name of the Lord.” The word “name” refers to God’s essence. All spiritual ministries must be consistent with the essence of God’s character. Later, James says that if one of the spiritually weak commits sins, God will forgive his sins, indicating that this is a spiritual, not a physical, problem.
The Bible does not teach that all sickness is the direct result of sin, but the Bible does teach that some physical illnesses are due to extensive unconfessed sin. The answer to spiritual failure is “confession” (Jas 5:16).
Ps. 32:5, “I acknowledged my sin to You.
And my iniquity I have not hidden.
I said, ‘I will confess my transgressions to the Lord,’
And You forgave the iniquity of my sin.”
Pr. 28:13, “He who covers his sins will not prosper,
But whoever confesses and forsakes them will have mercy.”
1 Jn 1:9, “If we confess our sins, He is faithful and just to forgive us our sins and to cleanse us from all unrighteousness.”
PRINCIPLE:
God guarantees the healing of spiritually sick people.
APPLICATION:
Some take the false doctrine of “extreme unction” from this passage. Extreme unction is the idea that people gain grace by anointing with oil at death to gain God’s approbation or favor. Nothing in this passage supports that idea.
Again, this verse does not teach that elders can heal physically sick people. It teaches that they can heal spiritually sick people. Confession of sin will deliver us from the power of sin. If we allow sin to control us over long periods of time, then God may use divine discipline on us.
Some sickness is due to our sin, and some God designs to glorify Himself. Not everyone who gets sick has a spiritual problem. Some things are better than physical healing. God does not always heal the sick. If that were so, then there would be no deaths. God designed that Paul had an eye disease (2 Co 12:9f). He allowed Timothy to have stomach problems. We all wait for the redemption of our bodies.
Ro 8:23, “Not only that, but we also who have the firstfruits of the Spirit, even we ourselves groan within ourselves, eagerly waiting for the adoption, the redemption of our body.”
The context of this verse is the sin unto death (Jas 5:20). This verse is the last call of the Lord before committing the sin unto death. We can shun the sin unto death through confession. We can address only certain physical illnesses by dealing with spiritual issues. Prayer can only heal a sick believer in deep rebellion against God.

FYI – The text is a duplicate of 5:14a and doesn't cover the second half of the verse.
David, 5:14b is now updated. Thanks again for calling this to my attention.