A 'safeword' is a code word or phrase (or a series of code words/phrases), or even a physical gesture or signal that is used during sex to communicate a physical or emotional state.
Safewords are most often used by participants in BDSM scenes or sexual activities that could be considered a little riskier in terms of approaching physical, emotional, and moral boundaries. Safewords are used to indicate when these boundaries are being crossed.
Safewords are agreed upon beforehand so that everyone involved is aware of what they are and what they mean when used. They are often words or phrases that are bizarre and wouldn't ordinarily be heard during sexual activity, such as "TRICERATOPS" or "OYSTER CARD". This is to ensure that they STAND OUT amongst the other weird things that may come out of an aroused persons mouth. Although do note that they shouldn't be so obscure that they are difficult to remember.
Sometimes a safeword is used as a code to say "NO" or "STOP" in order to immediately put an end to the activity. But where a series of safewords are negotiated upon, the words can have more specific meanings. For example a safeword could code for "stop doing that particular thing" or "lower the intensity" or "slow down".
There are some universally recognised safewords. Actually the word "safeword" is one. And there is a commonly used "red", "green", "yellow" traffic-light-style system to indicate what level of comfort a person is at.
A regular check-in system and the use of safewords ensures ongoing consent is communicated and obtained throughout BDSM play and other 'riskier' sexual activity.