c.1400, from Middle French escroue "nut, cylindrical socket, screwhole," of uncertain etymology; not found in other Romanic languages. Perhaps via Gallo-Romance *scroba or West Germanic *scruva from Vulgar Latin scrobis "screw-head groove," in classical Latin "ditch, trench," also "vagina" (Diez, though OED finds this "phonologically impossible").
Kluge and others trace it to Latin scrofa "breeding sow," perhaps based on the shape of a pig's penis (cf. Portuguese porca, Spanish perca "a female screw," from Latin porca "sow"). A group of apparently cognate Germanic words (Middle Low German, Middle Dutch schruve, Dutch schroef, German Schraube, Swedish skrufva "screw") often are said to be French loan-words.
Sense of "means of pressure or coercion" is from 1640s, probably in reference to instruments of torture (e.g. thumbscrews). Meaning "prison guard, warden" is 1812 in underworld slang, originally in reference to the key they carried. To have a screw loose "have a dangerous (usually mental) weakness" is recorded from 1810.
"to twist (something) like a screw," 1590s, from screw (n.). Slang meaning "to copulate" dates from at least 1725, on the notion of driving a screw into something. Meaning "a prostitute" also is attested from 1725. Slang meaning "an act of copulation" (n.) is recorded from 1929. First recorded 1949 in exclamations as a euphemism. Related: Screwed; screwing.