When a Catholic is very sick, the Church anoints the person with oil in a special ritual of healing called Anointing of the Sick. Traditionally referred to as Extreme Unction or Last Rites, the Sacrament of the Anointing of the Sick is administered both to the dying and to those who are ill or are about to undergo a serious operation, for the recovery of their health and for spiritual strength. It is a ritual of healing appropriate not only for physical but also for mental and spiritual sickness.
Source: Catechism of the Catholic Church