A look at the purpose of the Sacrament of the Anointing of the Sick tells us who the Church envisions to receive it.
The Sacrament of the Anointing of the Sick has a dual character, expressed by St. James in his New Testament letter: “Is anyone among you sick? He should summon the presbyters of the church, and they should pray over him and anoint [him] with oil in the name of the Lord, and the prayer of faith will save the sick person, and the Lord will raise him up. If he has committed any sins, he will be forgiven” (Jas 5:14-15).
The sacrament is intended to strengthen as well as to forgive sins. Because it involves forgiveness of sins, its celebration is reserved to priests and bishops. This is also why the Code of Canon Law says it is celebrated for persons “having reached the use of reason” (Canon 1004.1). The age of reason is generally considered to be about 7 years old.
Commentators and theologians suggest that the recipient of the sacrament must have the use of reason in order to profit from the two ends of this sacrament: to understand and benefit spiritually and psychologically from its strengthening grace, and to receive forgiveness of sins.
Children under the age of reason are not capable of sin and not capable of understanding the grace of this sacrament and receiving its consolation. Even though the Sacrament of the Anointing of the Sick cannot be offered, in such cases it is certainly appropriate to gather family and friends of the child for shared prayer.
A non-Catholic can receive the anointing of the sick, in special situations.
Our Lord and Savior Jesus Christ died to save all people. He won superabundant grace for us by His death on the Cross. The Church teaches that a person must be in the state of grace when he or she dies in order to get to heaven. One of the most effective means for grace is the sacraments, so we want to do whatever we can to provide the sacraments to all of the baptized, Catholic or not. For that reason, the Church allows baptized non-Catholic Christians to receive not only the anointing of the sick, but also the Sacrament of Reconciliation and the Holy Eucharist in special circumstances. Chief among those circumstances is when a person is in danger of death.
In these cases, there is only one requirement: the person must ask for the sacrament, and if the attending priest explains things clearly and has some pastoral skill and grace on his side, the gravely ill person usually wants to receive such sacraments.
This case is provided for in the Code of Canon Law: “If there is a danger of death . . . Catholic ministers may lawfully administer these same sacraments [penance, Eucharist, anointing of the sick] to other Christians not in full communion with the Catholic Church, who cannot approach a minister of their own community and who spontaneously ask for them, provided that they demonstrate the Catholic faith in respect of these sacraments and are properly disposed” (Canon 844.4)