'Redneck' has been a derogatory term used by one social/religious group about another for a very long time. For example, in parts of England it was used by Protestants to refer to Catholics and that situation was reversed in the Southern States of the USA. Likewise, Afrikaaners in South Africa applied the name 'rooinek' to the English settlers. More generally, though, it has been applied by the upper classes to the lower, labouring classes, presumably because the latter had to toil in the fields and got sunburnt as a result!
The earliest recorded written use of the word is in a book by A. Royall called 'Southern Tour'. It says: "Red Necks, a name bestowed upon the Presbyterians of Lafayetteville".