The West African kingdoms of Ghana, Mali and Shonghai traded slaves and gold with the Arab Empires of North Africa.
As the kingdom of Ghana expanded and conquered other smaller weaker tribes the kingdom acquired slaves, from these conquered tribes.
The Arab civilizations of North Africa wanted the slaves and gold for their economies.
The trade continued with the Mali Kingdom. Mansa Musa of Mali made a famous journey to Mecca as part of the slave, gold trade. He brought 12.000 slaves which carried 48.000 pounds of gold. This religious pilgrimage resulted in a depression in the value of both slaves and gold.
The Arab kingdoms invaded West Africa ending the last great West African Kingdom of Shonghai. The Arabs then took over the slave, gold trade directly. The African Kingdoms had for years enslaved other African tribes and sold the captives to the Arabs.