I am the light of the world; he who follows me will not walk in darkness, but will have the light of life.
The Sacrament of Baptism is often called "The door of the Church," because it is the first of the seven sacraments not only in time (since most Catholics receive it as infants) but in priority, since the reception of the other sacraments depends on it. It is the first of the three sacraments of initiation, the other two being the Sacrament of Confirmation and the Sacrament of Communion. Once baptized, a person becomes a member of the Church. Traditionally, the rite (or ceremony) of baptism was held outside the doors of the main part of the church, to signify this fact.
Christ Himself ordered His disciples to preach the Gospel to all nations and to baptize those who accept the message of the Gospel. In His encounter with Nicodemus (John 3:1-21), Christ made it clear that baptism was necessary for salvation: "Amen, amen I say to thee, unless a man be born again of water and the Holy Ghost, he cannot enter into the kingdom of God." For Catholics, the sacrament is not a mere formality; it is the very mark of a Christian, because it brings us into new life in Christ.
That doesn't mean that only those who have been formally baptized can be saved. From very early on, the Church recognized that there are two other types of baptism besides the baptism of water.
The baptism of desire applies both to those who, while wishing to be baptized, die before receiving the sacrament and "Those who, through no fault of their own, do not know the Gospel of Christ or His Church, but who nevertheless seek God with a sincere heart, and, moved by grace, try in their actions to do His will as they know it through the dictates of conscience" (Constitution on the Church, Second Vatican Council).