I'm specifically asking about Islamic slave trade, because wouldn't it be easier to enslave Europeans who didn't have to be transported across the desert? An explanation for later European preference for West Africans would be welcome as well.
1.) There is a long history of Europeans being enslaved by Islamic powers. The main reason that the numbers of these white slaves were never as great as African slaves was the relative power difference between European and Islamic nations from the late Middle Ages onward. It's difficult to enslave a group of people if the lands where they reside possess the military ability to repel your incursions. Many of the European slaves in the Muslim world were captured at sea via piracy.
2.) African slaves became preferred by the Europeans for several reasons. Politically, West Africa underwent many wars and the kings and warlords of West Africa often eagerly sold their captured war prisoners for European gold and other treasures. The Europeans also sought alternatives to enslaving the natives of North and South America because they were physically not well suited for heavy labor and could escape easily since they were familiar with the land and local tribes.