Poisonous "sneak snakes" (because unlike the rattlesnake they strike without previous movement or warning), hence the figurative use in reference to hidden danger or secret hostility.
The copper-head, though smaller, was much more feared. The rattle-snake was larger, sooner seen, and a true southerner, always living up to the laws of honor. He would not bite without provocation, and by his rattles gave the challenge in an honorable way. Instead of this well-bred warfare, the copper-head is a wrathy little felon, whose ire is always up, and he will make at the hand or the foot in the leaves or grass, before he is seen, and his bite is as poisonous as that of his brother of the larger fang. The young men tested his temper, and found that in his wrath he would bite a red hot coal. [Henry Howe, "Historical Collections of Ohio," 1854]
Specifically in reference to Northerners suspected of sympathizing with the Southern rebellion, the name is said to have been first used in Greeley's New York "Tribune," July 20, 1861. Charles H. Coleman, "The Use of the Term 'Copperhead' During the Civil War" ["Mississippi Valley Historical Review" 25 (1938), p.263] traces it to an anonymous letter against Ohio anti-war Democrats in the Cincinnati "Commercial" newspaper in the summer of 1861. It seems not to have been in widespread use until summer 1862. Related: Copperheadism.