You'll get quite a few answers depending on what sort of Christian you ask.
I'll be speaking from a Lutheran perspective, but in a lot of ways there will be some overlap with Catholic, Orthodox, and Anglican views as well because of similarities in our views on the nature, meaning, and purpose of Baptism.
To the question "Is Baptism necessary" the answer is most certainly a large and emphatic yes. But--and this is important--we would not argue that it is
absolutely necessary. Here's why: We can read in Scripture what Baptism is for and what Baptism accomplishes, namely that we are born again, clothed with Christ, crucified and raised together with Jesus, forgiven of all our sins, and receive the gift of the Holy Spirit (and so on), quite specifically we read,
"
Baptism, which corresponds to this, now saves you, not as a removal of dirt from the body but as an appeal to God for a good conscience, through the resurrection of Jesus Christ," - 1 Peter 3:21
So God works through His gift and Sacrament of Baptism to bring us salvation, by united us to His Son, by applying the righteousness of Christ to us by grace through the faith He so graciously gives us. Not
ex opere operato (Latin for "of the working of the work" or "the work itself") but on account of the Word--that God has united His Word to water in Baptism making it Baptism; Baptism is therefore efficacious because God has attached His promises to Baptism, e.g. "repent and be baptized all of you in the name of Jesus Christ for the forgiveness of your sins and you will receive the gift of the Holy Spirit" (Acts 2:38). There's nothing magical about the water of Baptism, it's what God has promised to do for us in Baptism that makes it important.
And here's where it's important: We have been told what Baptism does, and we can be confident that whoever is baptized is truly saved because God has said so and whatever God has said can never be false. This does
not mean that anyone who has
not been baptized, say for reasons beyond their control, cannot be saved or are therefore damned. It is entirely possible for one to have heard the good news, believed upon it, and never be able to be baptized--they are not damned on this account but instead again the efficacious Word of God is saving. Likewise it is not uncommon, especially in the ancient past, for there to be stories of catechumens--those desiring to become Christians undergoing catechesis in preparation for formal conversion and baptism--suffering from martyrdom before they can be baptized. Historically the Christian Church spoke of "baptism of desire" and "baptism of blood", that is if it weren't for an extraordinary circumstance (death, martyrdom, etc) such a person would have, of course, received Baptism and such an extraordinary circumstance prohibiting one from receiving Baptism does not cut one off from the grace and mercy of God, so they are said to have been baptized by their "desire" to be baptized, or by the blood they spilt in the case of martyrdom.
Again, coming from a specifically Lutheran perspective, Martin Luther himself points out that there are occasions where a child dies before he/she can be baptized, either because they died in childbirth or shortly thereafter or because the parents were slow in bringing their children to be baptized and tragedy befell them. Luther points out that we most certainly do not say that children who have not been baptized are damned because it would be absolutely wrong of us to do so. Luther makes the distinction between God's ordinary power and God's absolute power. But ordinary he means God's set and established order for things, and by absolute he means what God absolutely can do as God. So as an example of God's ordinary power he mentions fire, fire is hot and it burns, that is the set natural order for fire and we should never doubt it, and yet we read in the book of Daniel that three of Daniel's companions were thrown into the fiery furnace and were not harmed, not even their clothes were singed despite the great heat of the flames. Because God has acted absolutely, it is within God's absolute power to protect the companions of Daniel in the furnace, but we should not therefore assume that because God has acted absolutely in such an extraordinary way in this extraordinary circumstance that, therefore, fire is not hot and does not burn and that we can touch an open flame without getting burned--because of course we will. Likewise, the set order of God is that Baptism is necessary for salvation because He has established Baptism in the Church as the normative and ordinary means by which an individual is brought into the life of Christ in the Church; but we must remember that God can act in extraordinary ways through His absolute power to do whatever He wishes to do. And so--as an example--we can see in the case of the thief on the cross that Jesus says to him, "I tell you the truth, today you will be with Me in Paradise" and we can confidently say the thief was saved, because of the Word, Christ's word and promise is true and certain. It is the same Word we receive in Baptism, the Word we hear in the preaching of the Gospel.
The ordinary means is Baptism, so the baptized do indeed belong to Christ, this we can say with confidence on the sure and stable promises found in Scripture. We
cannot say that those who have not been baptized are damned simply because they have not been baptized. Such things are not in our purview as sinful mortals to declare on our own, but instead must trust in the wisdom, mercy, and justice of God for all things--God will do what God will do.
The ordinary means has been revealed to us and we must confess it.
But God is free to act absolutely in any way He so pleases without having revealed it to us, and it is not ours to speak here nor there on it, but to simply say God's will be done.
-CryptoLutheran