The Sacrament of the Anointing of the Sick is not a sacrament for those only who are at the point of death. Hence, as soon as anyone begins to be in danger of death from sickness, upcoming surgery, or old age, the fitting time for them to receive this sacrament has certainly already arrived. When the Sacrament of Anointing of the Sick is given, the hoped-for effect is that, if it be God's will, the person be healed of illness. But even if there is no physical healing, the primary effect of the Sacrament is a spiritual healing by which the sick person receives the Holy Spirit's gift of peace and courage to deal with the difficulties that accompany serious illness or the frailty of old age. The Anointing of the Sick is one of two sacraments of healing, the other being the Sacrament of Reconciliation. Those who wish to receive the Sacrament of the Anointing of the Sick are encouraged to receive the Sacrament of Reconciliation also.
"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." (CCC 1499)
"The first grace of this sacrament is one of strengthening, peace and courage to overcome the difficulties that go with the condition of 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 he has committed sins, he will be forgiven." (CCC 1520)