1640s, "the making of distinctions, act of observing or marking a difference," from Late Latin discriminationem (nominative discriminatio), noun of action from past-participle stem of discriminare "to divide, separate" (see discriminate (v.)). Sense of "making invidious distinctions prejudicial to a class of persons" (usually based on race or color) is from 1866 in American English in the language of Reconstruction. Meaning "discernment" is from 1814.
It especially annoys me when racists are accused of 'discrimination.' The ability to discriminate is a precious facility; by judging all members of one 'race' to be the same, the racist precisely shows himself incapable of discrimination. [Christopher Hitchens, "Letters to a Young Contrarian"]