Africans who were involved in the slave trade justified it as something that they had always done and something that they were not doing to their own people.
The first thing to realize is that we tend to think that all Africans should have identified themselves as Africans and that they should have realized that they were all in it together against the Europeans. But that is not how things were. The Africans were divided into different states and kingdoms that were often in competition with one another. We do not think it was strange that Romans fought their neighbors and enslaved them. We should not think it was strange that some African groups fought their neighbors and sold them into slavery.
If we could ask an African from that time how they would justify themselves, they would likely have felt it was a strange question. People have always fought one another and enslaved one another. That is all that they were doing. It is not like they were taking fellow citizens of their own country and selling them into slavery.
So, there are two major points here. First, we should not think that all Africans saw themselves as Africans rather than members of specific states or groups. Second, we should realize that many peoples have taken their enemies and enslaved them or sold them into slavery.