late 13c., "to condemn," from Old French damner "damn, condemn; convict, blame; injure," derivative of Latin damnare "to adjudge guilty; to doom; to condemn, blame, reject," from noun damnum "damage, hurt, harm; loss, injury; a fine, penalty," possibly from an ancient religious term from PIE *dap- "to apportion in exchange" [see Watkins]. The Latin word evolved a legal meaning of "pronounce judgment upon." Theological sense is first recorded early 14c.; the optative expletive use likely is as old.
Damn and its derivatives generally were avoided in print from 18c. to c.1930s (the famous line in the film version of "Gone with the Wind" was a breakthrough and required much effort by the studio). The noun is recorded from 1610s; to be not worth a damn is from 1817. The adjective is 1775, short for damned; Damn Yankee, characteristic Southern U.S. term for "Northerner," is attested from 1812. Related: Damning.
To criticize someone or something indirectly by giving a slight compliment: “When the critic remarked that Miller's book was ‘not as bad as some I've read,’ she was obviously damning it with faint praise.”