Baptism of Desire itself is God's Providence for His elect, just like Perfect Contrition, in which the desire for the Sacrament of Penance is implicit, is God's Providence for those to whom access to a Priest is morally or physically impossible at the moment. People want everything for themselves (e.g. forgiveness through contrition when a Priest is not available), yet stubbornly resist God's clearly revealed Will to save some souls by giving them the Sacramental Effect of both Baptism and Penance in voto only. God can do as He chooses, and is not bound to give His grace through the visible Sacraments only. The example of the Good Thief, the penitent Magdalene, Cornelius etc all confirm this. Baptism and Penance are both necessary in the same way: in fact or in desire. See Canon Law.
St. Bonaventure is another Doctor of the Church who taught Baptism of Desire, as is St. Bernard:
In Sent. IV, d.4,P.2,a.I,q.I: “God obliges no one to do the impossible and therefore it must be admitted that the baptism of desire without the baptism of water is sufficient, provided the person in question has the will to receive the baptism of water, but is prevented from doing so before he dies."Our Lord Jesus Christ Himself taught Baptism of Desire to St. Catherine of Sienna: Dialogue of St. Catherine:
"I wished thee to see the secret of the Heart, showing it to thee open, so that you mightest see how much more I loved than I could show thee by finite pain. I poured from it Blood and Water, to show thee the baptism of water which is received in virtue of the Blood. I also showed the baptism of love in two ways, first in those who are baptized in their blood shed for Me which has virtue through My Blood, even if they have not been able to have Holy Baptism, and also those who are baptized in fire, not being able to have Holy Baptism, but desiring it with the affection of love. There is no baptism of desire without the Blood, because Blood is steeped in and kneaded with the fire of Divine charity, because through love was it shed.Lastly, Baptism of Desire doesn't mean non-Catholics are saved; rather, it means those who are Justified by Baptism of Desire, and are foreknown by God to persevere in the State of Grace until death, will also be given the Grace to embrace the Catholic Faith before the end of their lives. Everyone in Heaven believed in and loves Jesus Christ and the Holy Trinity, venerates Mother Mary as Queen of Heaven etc. There are no non-Catholics in Heaven. Before departing this life, known to God alone sometimes, they must have explicitly believed at least in the Holy Trinity and Incarnation.
This is taught by Fr. Mueller in a Catechism approved by Rome: "
Q. Is it then right for us to say that one who was not received into the Church before his death, is damned?A. No.
Q. Why not?
A. Because we cannot know for certain what takes place between God and the soul at the awful moment of death.
Q. What do you mean by this?
A. I mean that God, in His infinite mercy, may enlighten, at the hour of death, one who is not yet a Catholic, so that he may see the truth of the Catholic faith, be truly sorry for his sins, and sincerely desire to die a good Catholic.
Q. What do we say of those who receive such an extraordinary grace, and die in this manner?
A. We say of them that they die united, at least, to the soul of the Catholic Church, and are saved."
The doctrine on the Soul of the Church is also taught by His Holiness Pope St. Pius X in his Catechism. Pope Pius XII also mentions it.