The Bible is not explicit on who will or will not be raised when Jesus returns. But we can draw some conclusions by carefully reading some passages.
And many of those who sleep in the dust of the earth shall awake, some to everlasting life, and some to shame and everlasting contempt. (Daniel 12:2)
This implies that there will be some who will not be raised — multitudes will be raised, but some will not.
There are a few passages that can shed light on who will not be raised. For example:
Man in his pomp yet without understanding is like the beasts that perish. (Psalm 49:20)
The context of this passage is the resurrection (see v15). The writer is personally confident of being raised to life again, but says that those who are ignorant of the gospel (“without understanding”) will perish like animals. Even riches will not save someone in this position.
They are dead, they will not live; they are shades, they will not arise; to that end you have visited them with destruction and wiped out all remembrance of them. (Isaiah 26:14)
This passage is speaking of foreigners who ruled the Israelites. Such people were largely ignorant of God and will not be raised.
There are also lots of passages that discuss people being raised to life to be judged for their actions. However, it is not fair to judge someone if they were ignorant of God’s requirements. This was acknowledged by Paul when he wrote “where there is no law there is no transgression” (Romans 4:15). Consequently, we can conclude that only those who have some knowledge of what God commands us to do will be raised and judged. For example,
The men of Nineveh will rise up at the judgment with this generation and condemn it, for they repented at the preaching of Jonah, and behold, something greater than Jonah is here. (Matthew 12:41)
So the people of Nineveh, who were taught about God by Jonah, will be raised. And so will the people who heard Jesus, and so had an opportunity to learn about the gospel.
Do not marvel at this, for an hour is coming when all who are in the tombs will hear his voice and come out, those who have done good to the resurrection of life, and those who have done evil to the resurrection of judgment. (John 5:28-29)
Some people have used this verse to claim that every person who has ever lived will be raised. However, that interpretation hinges on the word “all”. Jesus had just said “whoever hears my word” (v24). Such hearing brought responsibility. So the “all” in v28 would seem to mean all those who had heard his word and later died — they would all hear it again and be raised to judgement. He wasn’t talking about people in other countries and other times who may not have ever heard of Jesus or the God of the Bible.
Putting these various passages together, we can conclude that the people to be raised from the dead when Jesus returns are those who have had the opportunity to learn and respond to the gospel. People who have never had this opportunity can neither be rewarded or punished, and will remain dead.
For more information on the resurrection and judgement, see “Raised to Judgement”.