The context of the whole chapter of Matthew 24 is that Jesus is answering a question asked by his disciples in verse 3, "Tell us, when shall these be? and what is the sign of thy presence, and of the full end of the age?" So Jesus is letting the disciples know what will be happening before his return to earth through the time that he is present.
When we reach verse 21, Jesus is telling of a time of great tribulation or trouble, unlike anything before it … or after. Verse 22 tells us that if these days weren't shortened nobody would live through this time. This can be frightening if you stop here. Jesus knew this and let the disciples (and us) know that those days will be shortened so that all people will not be destroyed.
We learn more about this time of trouble in Daniel 12:1, "… there will be a time of distress such as never occurred since there was a nation until that time; and at that time your people, everyone who is found written in the book, will be rescued." So we know that during this time of trouble those who are found written in the book – the faithful Christians who are alive at that time – will be rescued – will die and be changed "in a moment, in the twinkling of an eye." (1 Corinthians 15:51,52).
In Matthew 24:22, it says "for the elect's sake those days shall be shortened." The Greek words for the phrase "for the elect's sake" are dia eklektos – "through the elect”. "The elect" are speaking of that same group of people as Daniel was – the faithful Christians. So how is it through them that the days would be shortened?
We know during this time since Jesus first came, God is taking out "a people for his name" as Peter said in Acts 15:14-17, "Simeon has related how God first concerned Himself about taking from among the Gentiles a people for His name. And with this the words of the Prophets agree, just as it is written, 'After these things I will return, and I will rebuild the Tabernacle of David which has fallen, and I will rebuild its ruins, and I will restore it, in order that the rest of mankind may seek the Lord, and all the Gentiles who are called by My name.’"
At this time the scripture will be fulfilled that "all who are in the tombs shall hear His voice and shall come forth." (John 5:28,29)
So, we know that once the faithful Christians have died and been glorified with Jesus, the time of trouble will be shortened, or stopped. Then the Lord will bring His Kingdom so the rest of mankind (all who have ever lived) will be able to seek the Lord and be blessed.
Just as it says in Micah 4:1-4, "And it will come about in the last days That the mountain of the house of the LORD Will be established as the chief of the mountains. It will be raised above the hills, And the peoples will stream to it. And many nations will come and say, 'Come and let us go up to the mountain of the LORD And to the house of the God of Jacob, That He may teach us about His ways And that we may walk in His paths.' For from Zion will go forth the law, Even the word of the LORD from Jerusalem. And He will judge between many peoples And render decisions for mighty, distant nations. Then they will hammer their swords into plowshares And their spears into pruning hooks; Nation will not lift up sword against nation, And never again will they train for war. And each of them will sit under his vine And under his fig tree, With no one to make them afraid, For the mouth of the LORD of hosts has spoken."