The system worked like this. Slaves were captured by other Africans, and sometimes Arabs, and brought to the coastal slave castles. Europeans were reluctant to venture inland because of the risk of disease.
Slaves were held in the slave castles until a boat was available, and they were then shipped across to the Atlantic. If they were really unlucky this might be to the industrialised plantations or mines of South America.
Millions of slaves [I have seen figures of 17 million] were shipped through these castles.
I had no idea any these still existed, but apparently several do, and have become World Heritage sites. I read about Cape Coast Castle in a review of St Clair's book. There was a bit about the destruction of a slave castle in Spielberg's excellent film, 'Amistad'.