Denmark and Holland made slavery illegal in the early nineteenth century. In Britain, the Slavery Abolition Bill of 1833 was passed and around 150,000 Africans currently on ships had to be freed. It became law the following year, which meant that all countries in the British Empire had to abide by it, so slavery ended in these places such as South Africa.
Other countries followed, some very slowly. For instance, slavery was only outlawed in Nigeria in 1936 . In America, the 13th Amendment abolished slavery in 1836. South American countries followed suit shortly afterwards.