Not just "some", basically the entire economy of the Barbary coast (roughly current day Algeria and Tunisia) was based on piracy and slave-trafficking. The slaves were white europeans and black africans from the sub-saharian zone. Conditions were extremely tough, males were usually castrated for eg. (which als explains why they never had much of a legacy, contrary to the slaves in european dominated lands), the slaves were worked to death (there was always more where they came from after all).
Molière's play Le bourgeois gentilhomme alludes to "turkish" (that is, barbaresque) piracy and slaving ; also the french warfleet bombed Alger for that reason during Louis XIV's reign. Later, the young United States's navy did the same in 1812 (IIRC), and finally France conquered what became later Algeria, ending the piracy for good
African/Arab slavery in general was suppressed by European colonisation, yet it went on as far as the 20th century. One could argue it's never really stopped.
This is a pretty serious mischaracterization of both the nature of the Barbary States and slavery therein.
While there was certainly some traditional piracy (which was, BTW, exactly same as what the Knights of Malta were doing), bythe late 18th c it was more or less a protection racket, where countries engaging in coastal shipping had to pay "tolls" to pass along the coast. Once the Napoleonic Wars were over, the growing imbalance of military power and technology was becoming apparent and the Powers decided there would be no more "tolls" - and Maltese pirates were also out of business at this point.
Males were almost never castrated, which was strictly against Islamic law. This was done in pagan Africa. Conditions were
not comparatively tough for slaves, which were used primarily as domestics, lalthough in early times men were often used as galley slaves, but while their lot was harder, they were entitled to a share of booty.
Slavery in Islamic society does not entail any social disability, i.e. your status was largely dependent upon who owned you. Manumission was common, as was marriage into the owner's family (which obviously involved being freed). A white American would rather chew his own balls off than marry his daughter to one of his slaves - this was not true in the Islamic world, where this was common.
This isn't an apology for Islamic slavery - the process of becoming a slave was still horrible, and loss of freedom is a crapshoot - you may end up with a kindly master, but you could also get a psychopath. In the Barbary States, slaves would be crammed in ships and transported across the Med, a terrible and often deadly experience - again, not as bad as Atlantic transit, and slaves do have rights in Islamic law.
Neither 18th c plays or Wikipedia are very good references for this subject.