When an individual is on their deathbed, anyone can baptize them into the Christian faith.
Baptism is a beautiful sacrament, one that opens the doorway to God’s grace into a person’s soul, initiating them into a personal relationship with Jesus Christ.
As the Catechism of the Catholic Church explains, “Holy Baptism is the basis of the whole Christian life, the gateway to life in the Spirit (vitae spiritualis ianua), and the door which gives access to the other sacraments. Through Baptism we are freed from sin and reborn as sons of God; we become members of Christ, are incorporated into the Church and made sharers in her mission: Baptism is the sacrament of regeneration through water in the word” (CCC 1213).
In normal circumstances, a bishop, priest or deacon is the ordinary minister of the sacrament. However, in an emergency, anyone can baptize a person who wants to be baptized.
In case of necessity, anyone, even a non-baptized person, with the required intention, can baptize, by using the Trinitarian baptismal formula. The intention required is to will to do what the Church does when she baptizes. The Church finds the reason for this possibility in the universal saving will of God and the necessity of Baptism for salvation. (CCC 1256)
Most often this is seen in birthing centers, where newborn infants are quickly baptized by a nurse or doctor, when death appears imminent. In this particular case, the parents request this to be done (usually beforehand) and those administering baptism do so with the right intention. Sometimes a baby will recover, in which case the parish priest will perform additional rites surrounding the sacrament of baptism, as it is not possible to be baptized twice.
At the other end of the spectrum, adults who are dying can also be baptized if they request it, by anyone who is present. Fr. Paul de Ladurantaye explains in the Arlington Catholic Herald exactly how this is done.
In the case of necessity (e.g., the danger of death), the person who baptizes pours water three times over the candidate’s head, or immerses the candidate three times in water, while simultaneously pronouncing the baptismal formula: “N., I baptize you in the name of the Father (the minster pours water or immerses the first time), and of the Son (the minister pours water or immerses a second time), and of the Holy Spirit (the minister pours water or immerses a third time).” A lay person who administers an emergency baptism must at least have the intention to do what the Church does when baptizing. It is also desirable that, as far as possible, one or two witnesses to the baptism be present.
It must be kept in mind that this type of baptism performed by laypeople should only be administered to people in an emergency situation. If the person recovers and returns to full health, then that person should present themselves to the nearest parish and explain their situation so that they can be fully welcomed into the Catholic Church.
If a priest or deacon is available and able to come to the bedside of someone dying, then that option should be pursued first. However, if that is not an option and time does not allow an extensive search for an ordained minister, a layperson should step in.