The anointing of the sick is a particular gift of the Holy Spirit. The first grace of this sacrament is one of strengthening, peace and courage to overcome the difficulties associated with serious illness or the frailty of old age. This grace is a gift of the Holy Spirit, who renews trust and faith in God and strengthens against the temptations of the evil one, the temptation to discouragement and anguish in the face of death. This assistance from the Lord by the power of his Spirit is meant to lead the sick person to healing of the soul, but also of the body, if such is God’s will. Furthermore, if the person being anointed has committed sins, she/he will be forgiven.
The Anointing of the Sick is not a sacrament for those only who are at the point of death. Hence, as soon as anyone of the faithful begins to be in danger of death from sickness or old age, the fitting time for her/him to receive this sacrament has certainly already arrived.
The anointing of the sick, by which the Church commends the faithful who are dangerously ill to the suffering and glorified Lord in order that he relieve and save them, is conferred by anointing them with oil and pronouncing the words prescribed in the liturgical books.
For more details, see the Catechism of the Catholic Church, starting at 1499 to 1532.