A sex contract is a formal agreement between two or more consenting adults acting on their own free will. This consensual agreement between lovers should never be confused with sex slavery or abuse.
Sex contracts can serve many functions within a relationship. A sex contract can be formal agreements about the values and principles you agree upon for your erotic life. Some couples who play with erotic power exchange or BDSM use sex contracts to formalize roles and boundaries. Contracts can also be used for limited periods of time, such as a vacation or date night, to create a specific experience together.
The erotic novel 50 Shades of Grey popularized the idea of sex contracts, and prompted many couples to explore the fantasy of entering formal erotic agreements and power exchanges.
Some people prefer to call it a Sex Commitment instead of a Sex Contract, which may or may not imply less formality of the agreement.