1769, from Modern Latin analis "of the anus;" see anus. Anal-retentive is attested by 1957 in psychological jargon. Anal sex attested as such from 1966.
Entries linking to anal
anus n.
"inferior opening of the alimentary canal," 1650s, from Old French anus, from Latin anus "ring, anus," from PIE root *āno- "ring." So called for its shape; compare Greek daktylios "anus," literally "ring (for the finger)," from daktylos "finger."