The gender binary is a model of gender that classifies all people into one of two genders. Under the binary model, gender is seen as a rigid binary option, like one or zero. The gender binary says there can be no more than two genders, with no "shades of grey" between the two. A person can only be one or other option, not both, neither or something between the two. The gender binary, as described, is largely a part of Western culture and thought. Many cultures give recognition to a slightly or significantly different system of genders. They can have more (nonbinary) gender roles, and flexibility for individuals who don't fit into one role. Western colonialism puts pressure on other cultures to conform to its own form of the gender binary. This form of racist and sexist discrimination is called binarism. There are individuals whose gender identity doesn't fit within this gender binary, who don't fit strictly into the "female" box or the "male" box. They are nonbinary. The gender binary makes problems for nonbinary people in the forms of oppression and discrimination such as nonbinary erasure.
Although the gender binary system is coercive and limiting, the binary genders themselves are valid identities.
Throughout world history, most cultures have used a model of gender roles that include female and male, with similar definitions to those familiar to Westerners, and many cultures recognize(d) additional genders. However, the gender binary, with its strict limitation to only two genders, is not a constant throughout all cultures in history. It is a relatively new concept that had its basis in the European Christian Church. Earlier Abrahamic religions and European cultures recognized additional genders and sexes. Western colonialism put pressure on cultures around the world to be like Western culture. One part of this was that Western colonialism made other cultures take up its model of the gender binary. Colonialists often had deadly penalties for people who didn't conform to it. This became a standard part of colonialist societies. This systematic form of oppression is called binarism.