If Islam is against slavery then why did Ottoman Empire and many other Muslim kingdoms kidnap people for slavery and conducted slave raids? Isn’t it haram in Islam?

The Ottoman empires and many other Muslim kingdoms conducted slave raids and kidnapped people to sell them in the markets. My question is isn't it haram to enslave people via kidnapping as Islam limited slavery to only prisoner of war.