"I came here in peace, seeking gold and slaves."
- – Jack Handey, What I'd Say to the Martians
Slavery is the institution of owning other humans (as well as other sapient beings by extrapolation) as property. As slaves are bound to their owners, they were prevented from leaving or refusing to work under threat of immediate violence for disobedience. When two groups would fight, it was not uncommon for the victor to capture some of the defeated along with the goods or territory and put them to work. Later on, as long-distance trade improved, they also began selling said captives to other cultures. The children of slaves usually were slaves themselves, though this was not universal.
In other cases, people would be put into slavery as a punishment, e.g. for failure to pay their debts, or voluntarily such as an alternative to paying for something. Some systems of slavery even offered opportunities for, like the Devshirmeh system in Ottoman Empire, where boys taken from among Christian vassals who were bright enough could actually end up as Grand Vizier of the Empire.
In addition to the practice of owning human beings as chattel, there are other contemporary and historical arrangements so similar to slavery that they are referred to as slavery informally or at that point in history. A few of these include serfdom (serfs were not owned, but they were bound to the land owned by nobles and are required to work the noble's land 2-3 days per week for free and keep what else they could grow-keep-trade), indentured servitude in colonial America (in exchange for passage to the new world being paid, criminal fines or to discharge a debt, someone would be indentured to a contract holder and have to work off their debt over a number of years such as British criminals), impressment and shanghaiing (where people were kidnapped from ports or ships and forced to serve as sailors with said debt not being hereditary), the various forced labor programs used by the Nazis, Communists, and other despotic regimes and the victims of human trafficking which is still ongoing today.
The oldest surviving codex of laws yet discovered in the world, the Code of Ur-Nammu, has multiple references to slaves, so slavery has been with humanity for a very long time. Slavery was practiced in virtually every culture at some point throughout their history; as soon as a people progressed from a hunter-gathering and nomadic culture to an agrarian one it became more convenient to look for ways to increase productivity and lower expenses. Before the advent of modern machinery, that way was some flavor of slave workforce since you generally had to spend less resources on a slave than you would on your fellow clan member.
In the ancient world, basically all civilizations made use of slavery to some degree or another. Prisoners of war were taken as slaves and made to ply their trade for their conquerors, or were sold abroad for goods. Since civilizations would wax and wane from time to time, the enslavers of one generation might end up enslaved in the next. The Greeks made heavier-than-usual use of slaves, and the Romans even more so. The Persians did not use slavery themselves and tried to limit it, but slavery did exist in their Empire among their conquered vassals. Slaves worked in every field from miners (who were quickly worked to death) to farmers, to factory workers and skilled craftsmen, to entertainers, teachers and doctors (particularly Greeks who could buy their freedom in a year, or even less if skilled) and even up to high ranking government officials in the Empire. Ancient Romans used to grumble about all these slaves coming in stealing people's jobs (this sentence is not a joke).
Slavery existed in Medieval Europe, but declined after the year 1,000 AD in a lot of places, especially the north. The basis for the modern English word slave gets its roots here, as the Slavic races were so often put upon that they pretty much named the ordeal after them. After the Europeans discovered the continent of Africa, there was much contact between local tribes and foreigners and many nations would take slaves from the peoples of Africa abetted at times by local slavery systems among African people themselves (see below). This brought up the matter of racial slavery. In the Classical World (and Rome in particular), slaves were basically from everywhere in the Empire and many places beyond and the children of freed slaves in Rome became more Romans. Slavery is not a nice thing even at the best of times, but racial slavery adds to it the conception that an enslaved race is inferior, doomed to servitude forever, and that people from it are unfit for anything else. Those caught up in it had little hope of ever elevating themselves from a state of being a form of livestock with the hands for manual labor. Slave ships sailed from Europe to Africa loaded with manufactured goods, textiles, guns and gunpowder which they traded for captives taken in war, who were then packed in like sardines to be shipped off to the New World. There they loaded up on tobacco and sugar and sailed back to Europe. In Brazil and most of the Caribbean between 1600 and 1800, the slave population never was able to achieve natural replacement rates due to a high death rate from overwork and abuse by their masters. The American system of slavery (aka "the peculiar institution") would arguably require an entire article of its own, but since we'd rather not try to poke that hornet's nest it's enough to say that it was not much better than the Caribbean experience and was only abolished after the American Civil War (which was followed by the system called the Jim Crow Laws, which is an issue for another article).
Africa is a continent with extreme varieties in cultures and groups, along with some lost history and slavery between local tribes. Between this and many foreign civilizations making extensive use of African slaves, the history of slavery in Africa is complicated and violent. In Africa, even prior to the Arab slave trade or the Atlantic/European slave trade, slavery happened in all the forms from ancient times. This was enacted between the various tribes and nations of Africa; however, in many African societies where slavery was prevalent, the enslaved people were not treated as chattel slaves and had certain rights in a system similar to indentured servitude elsewhere in the world. When the Arab slave trade and Atlantic slave trade began, many of the local slave systems began supplying captives for slave markets outside Africa. They also supplied criminals and captives from rival tribes or nations to the Arab, European or American slave trades. This means African slave traders unwittingly helped fan the flames of the issue of racial slavery, unaware of the exploitation and dehumanization these buyers would subject them to- and that's before the Scramble for Africa caused many of them to become slaves themselves.
In the Ottoman Empire, who can arguably can be seen as a continuity of the Eastern Roman Empire, the system was more or less the same, but with a small possibility of moving up if you were a Christian (or claiming to be one) because Christians (and Jews) are considered "people of the Book", meaning the worthiest of non-Muslim people according to Islam. Devshirmeh is the name for the system of taking one boy out of 40 houses from the population of Christian vassals in the Ottoman Empire; this mostly meant Balkan Christians with the inclusion of Bosniak Muslims, and Armenians, Romani and Jews were explicitly excluded. The sad and unwelcome reality of the devshirmeh system didn't stop some families from actively sending their kids, who were seen as too smart and full of potential to die toiling in some Balkan countryside; said desparation was often to the point of bribing the Janissary Aghas. The taken boys were converted to Islam (or pretended to, either way they didn't have a choice), then made into elite monastic troops called Janissaries (new soldiers); if they proved to be intelligent, they were sent to the Imperial Academy in Enderun to become bureaucrats. Being slaves, they had no habeas corpus and could be executed at any time - in theory. In practice, execution was a non-issue since they commanded enough power to dictate Ottoman military policy, married Ottoman princesses, engineered palace coups to kill off sultans who didn't pay them enough, and ended up even investing back in their native countries of Bosnia (the reason Bosniaks mourned the fall of the Janissary institution while EVERYONE ELSE celebrated it).
Female slaves in the Ottoman Empire could end up in the palace as a concubine, but this involved more mindfuckery and tricks between concubines than a game of poker with Tzeentch, and no concubine ever ended up dying in her bed. Ironically, concubines who lost the Sultan's favor would marry Viziers and other Ottoman Sipahi lords, and ended up far better than those gunning to the top. With the advent of nationalism, the French Revolution, and the growing need for military reforms bitterly opposed by the Janissaries, the system's flaws burst like rotting cysts, and Slavery went the way of the Dodo in 1847 thanks to Abdulmajid's reforms. The harem was numerous enough by then, and the freed whites went on with their lives while the black population settled in Western Turkey as free farmers.
Eurasia, particularly Ukraine, was the hotbed of slavery for the Ottoman Empire, with the port city of Caffa being the continent's major slave ports. The Russians liberated it from the Crimean Khanate, whose major income was thousands of taken women and children from villages, supplying the Ottoman Empire's need for European/white women. Evliya Çelebi even wrote about the despair and cries of women separated from their children and then sold separately.
In contrast to the above, slavery is virtually never mentioned in east Asian-inspired settings. This has some basis in history in certain areas: The Mongols' nomadic lifestyle was not conductive to widespread slavery, though they did take some captives as slaves (Genghis Khan himself was briefly a slave in his youth), and during the Mongol Empire's runs on conquering China people were often little better than slaves anyway. The Chinese themselves went through several periods of loosening and then making stricter laws surrounding slavery, usually rallying around who was in charge following their frequent wars to unify, only to break apart once more. The inhabitants of the Ryukyu islands "would die over" slavery rather than participate. Slavery in Asia was probably most prolific on the Korean peninsula, who had a caste system, but population growth, a few slave revolts and modernization eventually rendered it less than palatable.
The earliest European reports of Japan mention that, though it existed there, slavery was rare and primarily inflicted on debtors and prisoners of war. The main recorded examples are the maids/concubines of the rich, and those brought by Europeans themselves. One European held slave's physical stature impressed Oda Nobunaga so much that he purchased him, freed him and elevated him to samurai status. This man would be known as Yasuke, the only black samurai. During the Sengoku a not-insignificant of Japanese prisoners of war were sold to the Europeans for foreign trade until 1587/1595, when Toyotomi Hideyoshi banned it.
Slavery in Fantasy
Because slavery is viewed as such a moral repugnance throughout the modern world, it is an easy way for lazy GMs to get a reaction from players. Slavery being one of the common features of a setting's bad guys makes for an easy way to establish that civilization or organization is evil. A bunch of armed guys attack a peaceful village with chains and whips to catch its residents, bind them, and take them to their dwelling, where they're treated worse than how we treat livestock and forced to: toil, be beaten, probably raped, and made to fight to the death in arenas for the amusement and benefit of some sick bastards? That is more than enough reason to establish "these guys are bad, go kill their asses" regardless of alignment; even Evil characters can simply indulge their drive to kill by offing slavers, and exploit the freed villagers and their families for more favors - particularly Lawful Evil ones.
However, this is not always the case; both the perceived "good" and "bad" factions can also engage in slavery, although how they do it usually defines who's good and who's bad (regardless of how minute the difference is). Take Araby and the Dark Elves in the Warhammer Fantasy setting, for example. Both factions engage in wanton slavery and have no qualms about it being a common thing everywhere. However, what sort of defines each of them is how they see their slaves. In Araby, slaves have several rights, the children of slaves are guaranteed by law to not be slaves, and particularly cruel mistreatment of slaves will result in punishment to the masters and the mistreated becoming free. The Dark Elves consider all non-Dark Elves to be beneath them and will torture and maim their slaves, just because they think it is fun.
Though it is found in both, slavery is more common in fantasy settings than in science fiction. In your typical Tolkien knockoff, the way you go about digging rocks, harvesting lumber, tilling fields and raising buildings is normally with strong backs. In most sci-fi worlds, why have a bunch of slaves working in an irradiated asteroid space mine when you could have a bunch of robots who don't need slave drivers, don't require food or air, won't plot escape/rebellion (hopefully), and are stronger and easier to repair if damaged? Warhammer 40,000 actually justifies having slaves fairly well in that, in the Imperium, such automation is considered techno-heresy (or simply decayed like spaceship artillery loaders) due to a robot rebellion happening in the past and the risk of Chaos corruption for the machines, while the Dark Eldar are sick bastards who need to consume souls of psychically susceptible species (human youngsters are prime specimens, while Tau souls taste bland and weak) and get their rocks off at making others miserable.
A Digression About the Economics of Slavery
For serious worldbuilders who have it, you need to consider what economics already considers a long-standing question: Is slavery profitable in the long term, and if so where?
The consensus answer among economic historians to the first one is that yes, slavery can be profitable, but only in those situations where technology does not offer a faster/cheaper/safer solution. Indeed, most ancient Empires (Egyptian, Greek, Roman) had some form of institutionalized slavery that allowed them to endure. This being said, the very concept of slavery has some serious downsides (that have nothing to do with morality) dooming it in the long run. The short answer to the "where" question is "cash crops and other agriculture, unskilled labor, and a bit of mining", in roughly that order of profitability.
The practical downsides that doom slavery include, but are not limited to:
- First of all, in any area where sabotage is a serious concern slavery is usually a non-starter. For a recent example, look at the Nazis using forced labor to build their weapons later in the war, and the quality of said weapons. That rules out most semi-modern mining, as well as just about any industry with any degree of mechanization and a surprising amount of agriculture.
- Despite mining being the stereotypical use of slaves in fiction, mining past a certain depth is sufficiently deadly and expensive that semi-skilled labor is absolutely required, and a slave has a nice way to commit suicide AND hurt his master's profits at the same time. While other exploitative practices may be used, the training required means actual slavery-based mining is very much a no-go save for tasks such as the very basic work of breaking surface mineral seams, as well as open-pit mining, where "getting stuck" is not an issue and carrying loads to processing stations a la South American silver mining done by Spanish or simple stone quarries where all one needs doing is to hit a stone with a pick and carry the result to storage.
- Second, unless reproduction is heavily encouraged, slave populations have a tendency to drop over time, especially compared to relatively free populations (even ignoring manumission and escapes), and five seconds of thought on slaves' living conditions should lead to a few obvious conclusions as to why. So if you want to keep up, you need to constantly raid (or trade with raiders) for more slaves. Last time this was done beyond the 16th century, the United States wrecked the entire Barbary coast with artillery and freed slaves. So any "sustainable" raiding *will* attract military threats that will make sure any slave taken will eventually be more expensive than a free worker who is A) already available and willing, B) lives within the empire and C) has many motivations, such as family, welfare and hopes for a good future).
- Third, slave-holding societies are usually economically out-competed by non-slave-holding societies once military considerations are either removed or temporarily equalized. There are plenty of reasons for this, but the big ones are the twin spectres of Incentives (which align more closely in non-slave societies) and Efficiency (effort you expend on keeping slaves from escaping or rebelling could usually be more productively used elsewhere, and that's just to start, saying nothing of potentially intelligent slaves wasted in labor they are not optimal for rather than being educated and made into scientists).
- Fourth, if slaves are owned in large numbers they start to displace the local non-slaves. This is not a simple case of "DEY TOOK AHR JERBS", as the Romans can attest: when large numbers of slaves started to displace local farmers who were forced to sell their land for some reason or the other, said ex-farmers were driven to the cities, where there were not a lot of jobs either. This bred poverty, and from poverty rose a class dissatisfied with their lot in life as they starve while the rich grow fat. And from this rose political and civilian unrest, which is never good for any state. In the case of the Romans, this gave birth to a populist dictator, Julius Caesar and his adoptive son Octavian, which created a major precedent for all modern dictatorships and bread-and-circuses states.