Allaah (The Most High) said:
هُوَ الَّذِي بَعَثَ فِي الْأُمِّيِّينَ رَسُولًا مِّنْهُمْ يَتْلُو عَلَيْهِمْ آيَاتِهِ وَيُزَكِّيهِمْ وَيُعَلِّمُهُمُ الْكِتَابَ وَالْحِكْمَةَ وَإِن كَانُوا مِن قَبْلُ لَفِي ضَلَالٍ مُّبِينٍ
He it is Who sent among the unlettered ones a Messenger (Muhammad) from among themselves, reciting to them His Verses, purifying them and teaching them the Book and Al-Hikmah (As-Sunnah)). And verily, they had been before in mainfest error. [62:2]
Imaam As-Sadi (rahimahullaah) said:
The intent behind Al-Ummiyyeen [Unlettered ones] are those who neither had a book (i.e. a revealed book from Allaah) nor a fragment of (remaining) divine revelation, (such as) the Arabs and other than them, who are not from the people of the Scriptures (Jews and Christians). So Allaah (The Most High) bestowed a great favour on them – greater than His favour on others- because (prior to this) they had no knowledge and good (i.e. that which would lead them to righteousness in this life and success in the afterlife) and were upon clear misguidance. They worshipped trees, idols and stones, and behaved like wild beasts -the strong amongst them eating the weak ones. They were upon extreme ignorance in (relation to their acquaintance with the affairs of knowledge taught by the) Prophets. Thereafter, Allaah sent a Prophet from among them – they knew his lineage, his beautiful characteristics and truthfulness. (Allaah) revealed His Book (i.e. the Qur’aan) to him [i.e. This Messenger (sallal-laahu-alayhi-wasallam)];
[يَتْلُو عَلَيْهِمْ آيَاتِهِ – reciting to them His Verses]; Allaah’s clear verses, which necessitates (guidance to) Eemaan and Certainty. [وَيُزَكِّيهِمْ -purifying them] by commanding them with virtuous manners, explaining (such manners to them) in detail and forbidding them from evil manners.
[وَيُعَلِّمُهُمُ الْكِتَابَ وَالْحِكْمَةَ-and teaching them the Book (this Qur’an) and Al-Hikmah (The Sunnah); teaching them the Qur’aan and the Sunnah, which combines the (sound and upright) knowledge of earlier and later generations. So after this education and purification he (gave them), they become the most knowledgeable among the creation (i.e. among mankind and Jinn); rather they became the leaders of the people of knowledge and religion – the most perfect in their manners among the creation, and the ones with the best guidance and character. They became guided and others became guided through them, so they became the leaders of guidance and guides for the believers. So the sending of this Messenger to them is the most perfect (or excellent) favour and loftiest honour on them. [Source: Tayseer Kareem Al-Kareem Ar-Rahmaan Fee Tafseer Kalaam Al-Mannaan. Daar Ibn Hazm 1st edition 1424/2003. Abridged and slightly paraphrased]