All people are called by God to know him and to please him. The Catechism of the Catholic Church teaches, "The desire for God is written in the human heart, because man is created by God and for God; and God never ceases to draw man to himself. Only in God will he find the truth and happiness he never stops searching for" (CCC 27).
God freely gives everyone the grace to respond to his call. "Grace is favor, the free and undeserved help that God gives us to respond to his call to become children of God, adoptive sons, partakers of the divine nature and of eternal life" (CCC 1996).
So what happens to those who have the desire for God written on their hearts and are moved by grace to respond to him but never hear the gospel or know of Jesus? The Church teaches that they may attain salvation. Quoting from Vatican II document Lumen Gentium, the Catechism explains, "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 their conscience—those too may achieve eternal salvation" (CCC 847).