Slavery was very profitable and still is. Slavery is still legal and practiced around the world but these six countries (according to http://worldpopulationreview.com [Countries That Still Have Slavery 2021]) have the highest populations of those living as slaves. While over a hundred countries still have slavery, six countries have significantly high numbers:
- India (18.4 million)
- China (3.4 million)
- Pakistan (2.1 million)
- Bangladesh (1.5 million)
- Uzbekistan (1.2 million)
- North Korea (1.1 million)
So you can see that the profitably of slavery has managed to keep it in practice around the world.
As to why it ended I’ll assume you mean in America. Well, slavery is unethical. People, we are supposed to believe, are born with individual rights and freedoms. Slavery is oppressive and strips humans of their liberties. We have come to agree as a society that this is not good practice and who we do not want to be. However, just because we have made it illegal does not mean it doesn’t still exist here or anywhere else in the world.
Examples of slavery still in practice today in America include child sex trafficking, adult sex trafficking, forced immigrant labor, the purchasing of wives from foreign countries, etc. In spite of its illegal status and unethical nature slavery thrives around the world today. It is something we must continue to fight to strip from the planet.
Until we fight to abolish slavery and become much more civilized across a whole order of ethical issues we will never be granted membership in the United Federation of Planets and for good reason.