As the Church has taught for centuries, God offers everyone actual grace, so that they can do good. A person, baptized or not, may accept that grace or refuse it. A person who accepts the grace to do good and does it habitually, would be one who (as St. Thomas Aquinas points out), if he or she knew Jesus Christ, would clearly see him as the source of all good and would accept him as Lord and Savior and be redeemed by him. Whether this takes place as the person is dying (as Aquinas postulated) or during the person’s lifetime, is something we will learn only in heaven. “Those also can attain to everlasting salvation who through no fault of their own do not know the gospel of Christ or His Church, yet sincerely seek God and, moved by grace, strive by their deeds to do His will as it is known to them by the dictates of their conscience” (Vatican II, “Lumen Gentium”).
According to I Thessalonians 5:9: “God has not destined us for wrath, but to gain salvation through our Lord Jesus Christ.” Jesus, by his death and resurrection, is the redeemer of humankind (the title of Blessed John Paul II’s first encyclical) – whether the person accepts it or not, or even knows about it. We don’t know exactly how Jesus saves good Buddhists, Muslims, Mormons, atheists, etc., but Scripture gives a partial picture of it. In Matthew 25, Jesus invites the “blessed” into his kingdom because they clothed the naked, fed the hungry, gave drink to the thirsty, sheltered the homeless, and visited the sick and the prisoner. “Whatever you did to the least of these, you did to me” (v. 41).