"a trench made by digging," especially a trench for draining wet land," Middle English diche, from Old English dic "ditch, dike," a variant of dike (q.v.), which at first meant "an excavation," but later in Middle English was applied to the ridge or bank of earth thrown up in excavating. Middle English diche also could mean "a defensive wall."
As the earth dug out of the ground in making a trench is heaped up on the side, the ditch and the bank are constructed by the same act, and it is not surprising that the two should have been confounded under a common name. [Hensleigh Wedgwood, "A Dictionary of English Etymology," 1859]
Ditch-water "stale or stagnant water that collects in ditches" is from mid-14c. In Middle English, digne as dich water (late 14c.) meant "foolishly proud." Also see last-ditch.
late 14c., "surround with a ditch; dig a ditch or ditches in;" from ditch (n.). Meaning "to throw into a ditch" is from 1816, later especially "to throw a train off the tracks," hence the slang sense of "abandon, discard (as if throwing into a ditch)," first recorded 1899 in American English, and in reference to aircraft "to bring down into the sea," by 1941. The last might have been from or reinforced by the use of the ditch in naval slang for "the sea" (1922). Related: Ditched; ditching.