Are we contradicting ourselves by insisting on the necessity of Baptism and acknowledging at the same time the possibility of salvation for the un-baptized and non-believers? No, what we are saying is that those who “seek God with a sincere heart and, moved by grace, try to do his will as they know it through the dictates of their conscience” may be saved by virtue of their willingness to do God’s will (cf. Lumen Gentium 16, 1 John 5:1-3) even if they haven’t had the opportunity to receive Baptism. For “God has bound salvation to the sacrament of Baptism, but he himself is not bound by his sacraments” (CCC 1258).
Look at it this way: like all the other sacraments, Baptism is a better and more efficacious way for sanctification. “[It] is necessary for salvation for those to whom the Gospel has been proclaimed and who have had the possibility of asking for this sacrament” (CCC 1257, cf. Mark 16:16). But God is just and merciful; he will not penalize those who, through no fault of their own, have been deprived of the grace of hearing the Gospel and receiving Baptism.
The other significance of the fore-mentioned JPII statement is that regardless of one’s religion and belief, if anyone is saved, it’s because of Jesus’ salvific grace. For Jesus is “the way and the truth and the life. No one comes to the Father except through me” (John 14:6). In other words, Jesus’ redemptive sacrifice is necessary for the salvation of the whole world, including the baptized and the un-baptized, the believers and the non-believers, which is why he is the only Mediator between God and men.
It must be added in closing that it will be foolhardy to think that since the un-baptized and non-believers may also be saved, there’s no need to evangelize. The above-mentioned position of the Church does not diminish in any way the need and urgency of proclaiming the Gospel. This is because Jesus’ revelation is “definitive and complete”, made known to the Church “in the fullest possible way”. As a result, “she cannot do other than proclaim...the fullness of the truth which God has enabled us to know about himself” (Congregation for the Doctrine of the Faith, Dominus Iesus, 5) to people all over the world because they still haven’t received the fullest of the truth. And when you don't have the fullest of the truth, which is Christ himself, it's easy to fall prey to the force of evil.