To answer this question, we have to go back in history. Beginning with Adam, the first man, God has sent Prophets to invite His servants to the right path and eternal bliss. All Messengers were responsible only for their own people. However Prophet Muhammad, the last Prophet, was sent for all humanity and creation. His people, defined as all Muslims regardless of when and how they embraced Islam, are known as his community.
Today, many Muslims and non-Muslims are committing sins that were unheard of during earlier times. But since the Prophet was sent to humanity, we are shielded from the total annihilation or punishment visited upon earlier peoples: But God will not send them a punishment while you are among them. Nor is He going to send it while they continue to ask for pardon (8:33).
Another Qur'anic verse enlightens us about his mission's generality and comprehensiveness as well as the greatness and significance of his person. Jesus is quoted as entreating on behalf of his people: If you punish them, they are Your servants—If you forgive them, You are the Exalted in Power, the Wise (5:118). On the other hand, the All-Mighty said to Prophet Muhammad: "I will not send a punishment while you are among them and while they ask for My forgiveness."
Thus the Prophet's community has two important shields against Divine Wrath: the Prophet's physical (during his lifetime) and spiritual (after his death) presence, and the existence of sincere believers who seek His forgiveness and are allowed to do so by those in power. 
Many hadith record the Prophet's frequent pleading for his community's salvation.  One such prayer was made at 'Arafat and Muzdalifa during his Farewell Pilgrimage. There he asked God, among other things, not to punish his community. Some of his prayers were accepted and some were not. His Companions narrated his words as follows:
I asked God not to send a Divine Punishment upon my community. He accepted my prayer and replied: "I will not send a punishment upon them, but they will cause destruction among themselves. If they become sinners, I will let them quarrel and fight among themselves." Then I asked God again to lift such things from my community, but He did not agree to this. 
In conclusion, whole peoples will not be destroyed as long as sincere believers among the sinful multitudes worship and serve God, spread His Name and Word, seek His forgiveness, and strive to reform themselves and others.
 Muslim, Hajj, 147; Al-Bidaya wa l-Nihaya, 5:159.
 Muslim, Fitan, 19–20.