Sex is the attribute of being either male or female, categories which reflect biological reproductive functions. The female sex is defined as the one which produces the larger gamete (the egg) and which typically bears the offspring. In contrast, the male sex has a smaller gamete (sperm) and rarely bears offspring.
Sex can also refer to sexual intercourse, the physical act of reproduction, also known as "sexual relations" or "having sex."
In some animals, sex may be assigned to specific structures rather than the entire organism. Earthworms, for example, are normally hermaphrodites.
For a more detailed treatment, see Gender roles.
"Sex" defines what is biologically present, whereas "gender" defines what society expects of persons of different sexes. The distinction is important in law, as it tends to forbid discrimination on the basis of either, e.g. effeminate men cannot be fired for not acting according to their "gender". In other areas the distinction is primarily important for more abstracted social and legal arguments, rather than everyday use.
The term sex is often used to denote the activity of sexual relations, and as such it is subject to laws of social conduct.
Sexual morality in the Bible
From the beginning, God created the male and female as uniquely compatible and complimentary, and only joined them in the sanctified sexual union of marriage. All sexual relations with others outside that bond are revealed to be fornication, which is unconditionally (regardless of motive or circumstance) prohibited and condemned.
In the Bible a harlot or whore (KJV) was a woman who had sex before marriage, including prostitutes. If a man engaged in such with a single woman, he was required to marry her for life, while the death penalty was mandated for the man (or both if consensual) for engaging in sexual relations with a woman who was betrothed (contracted to marry) to another, or for a woman who married under the false pretense of being a virgin, and her husband objected upon discovering otherwise. Likewise, spiritual fornication was that of infidelity to God in making an idol to be one's god, with Israel being covenantally "married" to God.
In the Gospel of Mark 7:20-23 (cf. Mt. 15:19), Jesus declares that sin begins in the heart, and the iniquities that proceed out of the heart include fornications, which being plural, includes all sexual relations outside marriage. While broader descriptions exist (i.e. "the bed of love": Ezek. 23:17) sexual intercourse is what is usually indicated (by euphemisms) in laws against illicit sex, yet it is generally held that this is not limited to such, but prohibits all sexual eroticism outside marriage (in which it is exclusively sanctioned: Prov. 5:15-20: SoS), and which all "uncleanness"  covers.
Though more than one wife was allowed in the Old Testament, and even concubines were wives, the Lord Jesus restored that to the original standard of one man and one woman, for life (though most understand the fornication clause as allowing divorce in the case of marital infidelity, as fornication can include adultery). In so doing, (Mt. 19:4-9) Jesus defined the male and the female as constituting the "what" of "what therefore God hath joined together", and which, along with other verses, excludes same-sex marriage or other sexual unions. For a more detailed treatment, see Homosexuality and biblical interpretation.
- children are not simply born with a sense of their own gender but that their gender identity is formed through connections and interactions with others, primarily members of the same sex. 
- Grammar for a discussion of grammatical gender
- Gn. 1:27,27; 2:18-24; 1Cor. 11:8-12; Eph. 5:31
- Gn. 34:1-4,13,31; 38:15,18,24; Lv. 19:29; 21:9; Dt. 22:13-30; Num. 25:1; Jdg. 8:33; 2Chrn. 21:11; Prov. 7:10-12; Hos. 1:2; Ezek. 6:9; 16:17,36; 20:7,18; 23:7; Mat. 5:32; 15:19; 19:9; Jn. 8:41; Acts 15:20; 15:29; 21:25; Rom. 1:29; 1Cor. 5:1,11; 6:9,13,18; 7:2; 2Cor. 6:16; 12:21; Gal. 5:19; Eph. 5:3; Col. 3:5; 1Thes. 4:3; Heb. 12:16; 13:4; 1Pet. 4:3; Rev. 9:21, etc.
- Gn. 34:1-4,13,31; 38:15,18,24 Num. 25:1
- Dt. 22:13-29
- Ezek. 6:9; 23:30; 37:23
- Jer. 3:14; Ezek. 16:8
- Rm. 1:24; Eph. 5:3
- Adam Clarke, Matthew Henry, John Wesley, Eph. 5:3; Albert Barnes, Rm. 1:24
- Gn. 25:1; cf. 1Ch. 1:32; Gn. 30:4; cf. Gn. 35:22; 2Sam. 16:21, 22, cf. 2Sam. 20:3
- DIVORCE AND REMARRIAGE UNDER GOD By L. S. Boardman