According to both commentators, the audience of the surah is the disbelievers of the Quraysh. They have been warned that the Hour of Judgment is near. As a sign of this, the moon has been split. The purpose is that if they wish to understand, they can comprehend through this clear sign. Now, very little time remains for them. By mentioning the fate of previous nations, it has been cautioned that ‘if you continue on this path, your fate will be similar to theirs.’
Maulana Maududi states:
The disbelievers of Mecca have been warned regarding their obstinacy in opposing the invitation of the Messenger of Allah (PBUH). The astonishing event of the splitting of the moon was a clear sign that the Day of Judgment, which the Messenger of Allah (PBUH) was informing about, could indeed occur, and its time was drawing near. ... As the discourse begins, it is stated that these people do not accept when advised, do not take lessons from history, nor do they come to faith even after witnessing clear signs with their own eyes. Now, they will only believe when the Day of Judgment is actually established, and they are rushing toward the Day of Reckoning after emerging from their graves.
After this, the conditions of the people of Noah, ‘Ad, Thamud, the people of Lot, and the followers of Pharaoh are briefly described to illustrate how these nations suffered a painful punishment for rejecting the warnings of the messengers sent by God. After recounting the story of each nation, it is repeatedly emphasized that this Qur’an is an accessible means of admonition. If any nation were to take heed from it and turn to the right path, the punishments that befell those earlier nations would not become necessary for them. So then, what greater folly could there be than to reject this simple and clear source of guidance, and instead insist that one will not believe until punishment is actually witnessed?
Maulana Islahi writes:
The audience in this context refers to the deniers who were demanding a sign of punishment as evidence for the truth of the Qur’an’s warnings. They were seeking a sign that would convince them of the inevitability of the Qur’an’s threats if they continued to reject it. They have been cautioned by recounting the history of previous nations—in more detail than indicated in the previous surah—why they do not learn from the fate that befell those nations? Why are they stubbornly insistent that only when the same befalls them will they believe? It is a great favor of Allah that instead of showing you a sign of punishment, He has revealed a book to you that is comprehensive and complete in every aspect for your education and admonition, addressing all your doubts and suspicions, and adorning it with all necessary qualities and virtues. Yet, your condition is such that instead of seeking Allah’s mercy, you are asking for His punishment. (Tadabbur-e-Qur’an 87/8)