Psychologically it's been found that swearing helps [alleviate stress and pain] (https://web.stanford.edu/class/linguist1/Rdgs/jay00.pdf), so I can easily see how profanity could date back to ancient times.
In "Holy Sh*t: A Brief History of Swearing" the author postulates that swearing dates back to the time of the cavemen.
Go ahead and listen to the audiobook excerpt from that Amazon link, it talks about swearing in Roman times which corresponds perfectly to Spartacus. Swearing during the late medieval period (Game of Thrones) would also have been extremely common.