Going back in history, did the concept of bad words exist? When did they emerge? How recent is the concept of a slur, and was something like "barbarian" comparable to a slur given the seriousness of the word in those days? Did Ancient Egyptians also have no-no words?
I can't say much on the history of slurs, but I can say that "barbarian" did not have that connotation in ancient times. Barbaros (Greek) and barbarus (Latin) literally mean "foreigner." Some authors or speakers certainly had negative ideas of foreigners, and using barbarus implies an us vs. "them" other, but the term is typically not comparable to the modern connotations of "barbarian" and does not seem to have been used like a slur. If we had the testimony of those called barbaroi, we might have a different picture, but with the current evidence this does not seem to be the usage. You might be interested in Edith Hall or Benjamin Isaac's books for more on development of "others" and "barbarians." I hope someone can say more on that question about slurs!
Romans did have bad words, though, or at least "dirty" words. The opening lines of Catullus 16 are probably the most famous example, and illustrates a few of them:
Pedicabo ego vos et irrumabo,
Aureli pathice et cinaede Furi
In English (warning, explicit language): >!"I will fuck you in the ass and make you suck my dick, bottom Aurelius and homo Furius."!< These opening verbs pedicabo and irrumabo do not come up much in Latin literature, probably because they are so explicit and not for "elite" literature. The elite language of literature probably does not match with how people have spoken and insulted each other. Another problem is the sensibilities of those who made dictionaries, translations, and text books (usually in the 19th to early 20th centuries) that are still in use or available. These sorts of lines would be skipped over or translated in a way that you can't tell it's explicit. For example, the Lewis and Short dictionary gives "to treat in a foul manner" as a definition for irrumabo (L&S s.v. "irrumo" II.a). Other sexually explicit terms often get glossed in a similarly opaque manner. Much of our modern sensibilities affects how we interpret what is bad--even if these words would have been considered inappropriate or offensive, our views (or those of recent historical interpreters) can get in the way.
Back to Catullus, the terms pathicus and cinaedus (borrowed from Greek) are used a lot as insults. They are both terms for men who are penetrated during sex. To the Romans, it was acceptable for free men to have sex with other men, as long as they were taking on the "active" role in those encounters. So, a free man who engaged in the "passive" role, that is being penetrated, was derided with these terms. I have even seen cinaedus translated as the f-slur, so perhaps it gets back to your original question about slurs.
The Romans (and Greeks) had some inappropriate words, and insults were often aimed at one's sexual behavior; Suetonius' Lives of the emperors often relates stories about inappropriate (to the Romans) sexual activity as a way to discredit that leader. For example, he famously described Julius Caesar as “the husband of every wife and the wife of every husband” (Suet. Iul. 52.3: omnium mulierum uirum et omnium uirorum mulierem appellat) to deride his supposed sexual preferences in male-male encounters.
I hope someone else can delve into this topic linguistically or for the concept of a slur.
Some sources:
Adams, James Noel. The Latin Sexual Vocabulary. Baltimore: The Johns Hopkins University Press, 1990.
Dutsch, Dorota and Ann Suter, editors. Ancient Obscenities: Their Nature and Use in the Ancient Greek and Roman Worlds. Ann Arbor: University of Michigan Press, 2015.
Hall, Edith. Inventing the Barbarian: Greek Self-Definition through Tragedy. Oxford: Oxford University Press, 1989.
Isaac, Benjamin. The Invention of Racism in Classical Antiquity. Princeton, NJ: Princeton University Press, 2006.
Richlin, Amy. The Garden of Priapus: Sexuality and Aggression in Roman Humor. New York: Oxford University Press, 1992. (Amy Richlin as worked a ton on this topic and a lot of her work could tell you about Roman sexual vocabulary).