What is the origin for the word "sex" in its various grammatical forms (the noun "sex" and the verb "sex")? What is the historical definition of this word? How has it morphed into the definition of sex today?
Latin had a word sex, but it didn't have the same meaning as in English. Instead, it's cognate with English "six", and means the same thing.
English "sex" comes from Latin sexus, -ūs, which comes from a root sec- meaning "cut" (compare section, dissect, segment). The original meaning was "division", which shifted to "a way of dividing something in half", and thus to "the division between men and women; biological sex". That's the meaning it had in Classical Latin.
This led to an adjective sexuālis, -is, -e, "pertaining to the sexes", as in "sexual dimorphism", "sexual reproduction", etc. This adjective got associated with sex in the modern sense through phrases like "sexual intercourse".
Over time this got shortened just to "sex", as a noun meaning the physical act, and then that turned into a verb. But these were purely post-Latin developments. In Latin, sexus means "sex" as in the male/female binary, nothing more.
Notice sex as a verb (e.g. "to have sex") is a 20th century English meaning. The earliest quote in the Oxford English Dictionary about this meaning is from 1921:
K. Burke Let. 20 Aug. in K. Burke & M. Cowley Sel. Corr. (1988) 98 Our baby is eighteen months old now, and cries when we sex.
This is, sex does not mean sexual intercourse in Latin. This is expressed with words like coitus.
Regarding its meaning as a noun (as in gender), the same dictionary states:
Origin: Of multiple origins. Partly a borrowing from French. Partly a borrowing from Latin. Etymons: French sexe; Latin sexus.
Etymology: < Middle French, French sexe the genitals (c1200 in Old French as sex ), gender, state of being male or female (c1230, 14th cent. as a social category, 1546 with reference to plants), sexuality, physical lovemaking, eroticism (1856) and its etymon classical Latin sexus (u- stem) state of being male or female, specific qualities associated with being male or female, males or females collectively, sexual organs, of uncertain origin (perhaps compare secāre to cut (see secant adj.), though the semantic connection is unclear). Compare Old Occitan sexe (1420), Catalan sexe (1515), Spanish sexo (first half of the 15th cent.), Portuguese sexo (1572), Italian sesso (14th cent.). Latin had also a form secus , neuter (indeclinable).
Thus, regarding the origin of "sex" in terms of Latin, it seems to come from sexus, or secus, jointly with the French "sexe" (actually, as the entry above shows, "sexe" was also an Middle English word).
PS: this post (about the etymology of the number sex and the noun sexus) has some more insights on the origin of sexus.