james 5:14
"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.
By the sacred anointing of the sick and the prayer of the priests the whole Church commends those who are ill to the suffering and glorified Lord, that he may raise them up and save them. And indeed she exhorts them to contribute to the good of the People of God by freely uniting themselves to the Passion and death of Christ.
As soon as anyone of the faithful begins to be in danger of death from sickness or old age, the fitting time for him to receive this sacrament has certainly already arrived.
If a sick person who received this anointing recovers his health, he can in the case of another grave illness receive this sacrament again. If during the same illness the person’s condition becomes more serious, the sacrament may be repeated. It is fitting to receive the Anointing of the Sick just prior to a serious operation. The same holds for the elderly whose frailty becomes more pronounced. – CCC, 1499, 1514-1515