Is baptism necessary for salvation? Yes, the Church teaches it is. Christ himself says no one can be saved if they're not born of water and spirit. However, it is not absolutely necessary in the sense that without it one is absolutely lost. God has a way of providing for those who could not get baptized, or who were in RCIA but died before being baptized, or unbaptized/aborted infants.
Below are quotes from the Fathers on the necessity of baptism.
“‘I have heard, sir,’ said I [to the Shepherd], ‘from some teacher, that there is no other repentance except that which took place when we went down into the water and obtained the remission of our former sins.’ He said to me, ‘You have heard rightly, for so it is’” (The Shepherd 4:3:1–2 [A.D. 80]).
“As many as are persuaded and believe that what we [Christians] teach and say is true, and undertake to be able to live accordingly . . . are brought by us where there is water, and are regenerated in the same manner in which we were ourselves regenerated. For, in the name of God, the Father and Lord of the universe, and of our Savior Jesus Christ, and of the Holy Spirit, they then receive the washing with water. For Christ also said, ‘Except you be born again, you shall not enter into the kingdom of heaven’ [John 3:3]” (First Apology 61 [A.D. 151]).
“Happy is our sacrament of water, in that, by washing away the sins of our early blindness, we are set free and admitted into eternal life. . . . [But] a viper of the [Gnostic] Cainite heresy, lately conversant in this quarter, has carried away a great number with her most venomous doctrine, making it her first aim to destroy baptism—which is quite in accordance with nature, for vipers and.asps . . . themselves generally do live in arid and waterless places. But we, little fishes after the example of our [Great] Fish, Jesus Christ, are born in water, nor have we safety in any other way than by permanently abiding in water. So that most monstrous creature, who had no right to teach even sound doctrine, knew full well how to kill the little fishes—by taking them away from the water!” (Baptism 1 [A.D. 203]).
“Without baptism, salvation is attainable by none” (ibid., 12).
“We have, indeed, a second [baptismal] font which is one with the former [water baptism]: namely, that of blood, of which the Lord says: ‘I am to be baptized with a baptism’ [Luke 12:50], when he had already been baptized. He had come through water and blood, as John wrote [1 John 5:6], so that he might be baptized with water and glorified with blood. . . . This is the baptism which replaces that of the fountain, when it has not been received, and restores it when it has been lost” (ibid., 16).
“[P]erhaps someone will ask, ‘What does it conduce unto piety to be baptized?’ In the first place, that you may do what has seemed good to God; in the next place, being born again by water unto God so that you change your first birth, which was from concupiscence, and are able to attain salvation, which would otherwise be impossible. For thus the [prophet] has sworn to us: ‘Amen, I say to you, unless you are born again with living water, into the name of the Father, Son, and Holy Spirit, you shall not enter into the kingdom of heaven.’ Therefore, fly to the water, for this alone can extinguish the fire. He who will not come to the water still carries around with him the spirit of insanity for the sake of which he will not come to the living water for his own salvation” (Homilies11:26 [A.D. 217]).
“It is not possible to receive forgiveness of sins without baptism” (Exhortation to the Martyrs 30 [A.D. 235]).
Cyprian of Carthage
“[T]he baptism of public witness and of blood cannot profit a heretic unto salvation, because there is no salvation outside the Church.” (Letters 72:21 [A.D. 253]).
“[Catechumens who suffer martyrdom] are not deprived of the sacrament of baptism. Rather, they are baptized with the most glorious and greatest baptism of blood, concerning which the Lord said that he had another baptism with which he himself was to be baptized [Luke 12:50]” (ibid., 72:22).
Cyril of Jerusalem
“If any man does not receive baptism, he does not have salvation. The only exception is the martyrs, who even without water will receive the kingdom.
. . . For the Savior calls martyrdom a baptism, saying, ‘Can you drink the cup which I drink and be baptized with the baptism with which I am to be baptized [Mark 10:38]?’ Indeed, the martyrs too confess, by being made a spectacle to the world, both to angels and to men [1 Cor. 4:9]” (Catechetical Lectures 3:10 [A.D. 350]).
“[Besides the baptisms associated with Moses, John, and Jesus] I know also a fourth baptism, that by martyrdom and blood, by which also Christ himself was baptized. This one is far more august than the others, since it cannot be defiled by later sins” (Oration on the Holy Lights 39:17 [A.D. 381]).
“It would tend to the ruin of our souls if, from our refusal of the saving font of baptism to those who seek it, any of them should depart this life and lose the kingdom and eternal life” (Letter to Himerius 3 [A.D. 385]).
“Do not be surprised that I call martyrdom a baptism, for here too the Spirit comes in great haste and there is the taking away of sins and a wonderful and marvelous cleansing of the soul, and just as those being baptized are washed in water, so too those being martyred are washed in their own blood” (Panegyric on St. Lucian 2 [A.D. 387]).
Ambrose of Milan
“But I hear you lamenting because he [the Emperor Valentinian] had not received the sacraments of baptism. Tell me, what else could we have, except the will to it, the asking for it? He too had just now this desire, and after he came into Italy it was begun, and a short time ago he signified that he wished to be baptized by me. Did he, then, not have the grace which he desired? Did he not have what he eagerly sought? Certainly, because he sought it, he received it. What else does it mean: ‘Whatever just man shall be overtaken by death, his soul shall be at rest [Wis. 4:7]’?” (Sympathy at the Death of Valentinian [A.D. 392]).
“There are three ways in which sins are forgiven: in baptism, in prayer, and in the greater humility of penance; yet God does not forgive sins except to the baptized” (Sermons to Catechumens on the Creed 7:15 [A.D. 395]).
“I do not hesitate to put the Catholic catechumen, burning with divine love, before a baptized heretic. Even within the Catholic Church herself we put the good catechumen ahead of the wicked baptized person. . . . For Cornelius, even before his baptism, was filled up with the Holy Spirit [Acts 10:44–48], while Simon [Magus], even after his baptism, was puffed up with an unclean spirit [Acts 8:13–19]” (On Baptism, Against the Donatists 4:21:28 [A.D. 400]).
“That the place of baptism is sometimes supplied by suffering is supported by a substantial argument which the same blessed Cyprian draws from the circumstance of the thief, to whom, although not baptized, it was said, ‘Today you shall be with me in paradise’ [Luke 23:43]. Considering this over and over again, I find that not only suffering for the name of Christ can supply for that which is lacking by way of baptism, but even faith and conversion of heart [i.e., baptism of desire] if, perhaps, because of the circumstances of the time, recourse cannot be had to the celebration of the mystery of baptism” (ibid., 4:22:29).
“When we speak of within and without in relation to the Church, it is the position of the heart that we must consider, not that of the body. . . . All who are within [the Church] in heart are saved in the unity of the ark [by baptism of desire]” (ibid., 5:28:39).
“[According to] apostolic tradition . . . the churches of Christ hold inherently that without baptism and participation at the table of the Lord it is impossible for any man to attain either to the kingdom of God or to salvation and life eternal. This is the witness of Scripture too” (Forgiveness and the Just Deserts of Sin, and the Baptism of Infants 1:24:34 [A.D. 412]).
“Those who, though they have not received the washing of regeneration, die for the confession of Christ—it avails them just as much for the forgiveness of their sins as if they had been washed in the sacred font of baptism. For he that said, ‘If anyone is not reborn of water and the Spirit, he will not enter the kingdom of heaven’ [John 3:5], made an exception for them in that other statement in which he says no less generally, ‘Whoever confesses me before men, I too will confess him before my Father, who is in heaven’ [Matt. 10:32]” (The City of God 13:7 [A.D. 419]).
Pope Leo I
“And because of the transgression of the first man, the whole stock of the human race was tainted; no one can be set free from the state of the old Adam save through Christ’s sacrament of baptism, in which there are no distinctions between the reborn, as the apostle [Paul] says, ‘For as many of you as were baptized in Christ did put on Christ; there is neither Jew nor Greek . . . ‘ [Gal. 3:27–28]” (Letters 15:10 [A.D. 445]).
Fulgentius of Ruspe
“From that time at which our Savior said, ‘If anyone is not reborn of water and the Spirit, he cannot enter into the kingdom of heaven’ [John 3:5], no one can, without the sacrament of baptism, except those who, in the Catholic Church, without baptism, pour out their blood for Christ, receive the kingdom of heaven and life eternal” (The Rule of Faith 43 [A.D. 524]).