"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.