After the fall of the Roman Empire, slavery continued to exist in Spain under the rule of the Visigoths and the Moors. In the 8th century, the Umayyad Caliphate conquered Spain and brought with them a large number of slaves from Africa. The slave trade flourished in Spain under Muslim rule, and slaves were used for a variety of purposes, including agricultural labor, domestic service, and military service.
In the 15th century, the Spanish began to explore and colonize the Americas. They brought with them the institution of slavery, and soon African slaves were being used in large numbers on plantations and mines in the New World. The Spanish slave trade continued for several centuries, and it is estimated that over 12 million Africans were brought to the Americas as slaves.
Spain abolished slavery in 1811, but it was not until 1866 that slavery was finally abolished in all Spanish colonies.