OED
A Negro. slang. (Derog.)
1862 Songs for the Times 3 Play up, Pomp, you yaller coon. 1892 Congress. Rec. 4 Feb. 856/1 Instead of seating one colored Representative, they seated two,{em}two coons in place of the elected Representatives of the people. 1903 Westm. Gaz. 18 May 3/2 The former represented a lively…jovial coon{em}possibly ‘coon’ is not the right word, which, however, is accepted here as modern slang for a nigger. 1948 Chicago Defender 23 Oct. 7/2 A lot of us are referred to as ‘nigger’, ‘coon’, ‘darky’, etc., right to our faces. 1969 Oz Apr. 46/3 You might…deplore the way that the publicity was angled{em}poor old coon, he’ll thank us in the end.
Origin is unknown. Suggested to have derived from “barracoon. A rough barrack, set of sheds, or enclosure, in which Black slaves (originally), convicts, etc., are temporarily detained.” Barracoon itself is Portugese in origin.