BT's observation is correct. Olive oil was often mixed with herbs, wine or others components and used as a medicine. There are two views of this passage's interpretation and both can be supported from Scripture. The first is what BT has already mentioned. Seeking what medical treatment is available, but since this is mentioned in context with the calling of the elders, and most elders are not medically trained, this might be the weaker of the interpretations. That even though this is a viable possibility.
In context this passage is tied to confession of sins one to another and the prayer of faith. Verse 16 reads: "Therefore, confess your sins to one another, and pray for one another, so that you might be healed." I we look at what we have here we start with someone who is sick. The nature of the illness is not specified, it could be anything from a cold to cancer. The individual is to call for the elders to come to them. The healing that is promised is coupled to the forgiveness of committed sins. For this reason there are many who have come to interpret this as referring to an instance where the individual who is ill, is ill as result of some unconfessed sin in their life that has broken fellowship between that believer and the Lord. The illness is seen as a means of driving that person to repent of their sin and restore fellowship with G-d.
We are told in Scripture that whom the Lord loves, He chastens. The terms used in the New Testament for "chasten" and "punish" both have a primary meaning of training or instruction. It appears that there is a possibility of the Lord using an illness to discipline and restore fellowship with a believer who has, or is sinning. In this case they are to call for the elders, confess (repent of) their sin, and allow the elders to pray for them and anoint them with oil. Many times in Scripture the anointing with oil represents the Holy Spirit coming upon that individual. In the case where a person has sinned to the point of needing intercession by the elders, they will have severely quenched the Holy Spirit working in their life.
1 John 5:16
If any man see his brother sin a sin which is not unto death, he shall ask, and he shall give him life for them that sin not unto death. There is a sin unto death: I do not say that he shall pray for it
1 John 5:17 "All unrighteousness is sin: and there is a sin not unto death."
These passages from John's epistle seem to confirm that there are times when illness is sent to discipline a wayward believer, even unto death if their sin has gone too far in dishonoring their relationship and reputation for the Lord. We are instructed NOT to pray for one who has sinned unto death.
Before you reject this possible interpretation of this passage in James, consider this. If this formula is followed healing is promised. Why do we have believers in the church that die from illness if all that has to happen is to have the elders come, anoint them with oil and pray for them to be healed? Either James is lying, the elders aren't praying in faith or it is speaking about a specific illness that is a result of unconfessed sin in the life of that believer.
Believers can and do get sick with illnesses that that take their lives, not because they lack faith or they weren't properly anointed. It is because G-d has some purpose that we may not understand, for this illness and death in the life of the believer.