Short answer
Islam spread in West Africa mainly through trade across the Sahara, from around the eighth and ninth centuries CE. Muslim merchants and scholars came with the caravans, local kings converted, and great Muslim centres grew in Mali, Songhay and Timbuktu.
The accepted historical account is that West Africa became Muslim gradually, over many centuries, through merchants, scholars and Sufi orders, with rulers such as those of Takrur, Gao and Mali among the early converts. The Maliki school became dominant there.
The four schools agree on this.
Explanation
Camels made regular crossings of the Sahara possible. Berber and Arab traders from North Africa carried salt, cloth and books south and brought back gold. They settled in trading towns, built mosques and married locally. Kings found literate Muslim advisers and links to the wider Muslim world useful, and many converted. Early examples include the rulers of Takrur on the Senegal river and of Gao on the Niger, around the eleventh century CE.
The Mali empire became a famous Muslim power. Its ruler Mansa Musa made the Hajj in 724 AH (1324 CE), and stories of the gold he spent in Cairo spread across the Mediterranean. He brought back scholars and builders. Ibn Battuta visited Mali in the 1350s and praised its people's care for the Friday prayer, their safety on the roads and their eagerness to memorise the Quran.
Timbuktu grew into a centre of learning, with mosques such as Sankore and thousands of manuscripts in Arabic. Under the Songhay empire, Askiya Muhammad continued that support. Islam spread further from the towns into the countryside over later centuries, through scholars and Sufi orders such as the Qadiriyya, and through the reform movements of the nineteenth century such as that of Uthman dan Fodio in what is now northern Nigeria.
Most West Africans follow the Maliki school, the school of Madinah, which came with the North African scholars. See How did Islam come to Africa? and Was Islam spread by the sword?
The evidence
Quran, Surah An-Nahl 16:125
ٱدْعُ إِلَىٰ سَبِيلِ رَبِّكَ بِٱلْحِكْمَةِ وَٱلْمَوْعِظَةِ ٱلْحَسَنَةِ ۖ وَجَٰدِلْهُم بِٱلَّتِى هِىَ أَحْسَنُ ۚ إِنَّ رَبَّكَ هُوَ أَعْلَمُ بِمَن ضَلَّ عَن سَبِيلِهِۦ ۖ وَهُوَ أَعْلَمُ بِٱلْمُهْتَدِينَ ﴿١٢٥﴾
Invite to the way of your Lord with wisdom and good instruction, and argue with them in a way that is best. Indeed, your Lord is most knowing of who has strayed from His way, and He is most knowing of who is [rightly] guided.
Calling to Islam by wisdom and good example, as traders and scholars did.
Where the ruling is recorded
- Rihla (Ibn Battuta), Account of his journey to the land of the Sudan (Mali). An eyewitness account of Muslim life in fourteenth century Mali.
- Kitab al-Masalik wa al-Mamalik (al-Bakri), Section on Ghana and the lands of the Sudan. An eleventh century description of the Muslim traders and early converted kings.
- Tarikh al-Sudan (al-Sa'di), Chapters on Timbuktu, Mali and Songhay. A Timbuktu chronicle of the scholars and rulers.
This answer is pending review by the scholars on our team. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.