Was there any punishment for killing slaves, and what punishment was given for it, and was it enforced?
Yes, murder of a slave was illegal in the antebellum South, and it was a capital offence.
An example is the case of John Hoover of North Carolina. He was arrested on 28 March 1839 for the murder of one of his slaves named Mira. He was brought to trial on 12 September 1839 before a jury of his peers (i.e. 12 male slaveholders).
At his trial, it was recorded that Hoover had declared that:
“the negro was his own property and he had a right to do as he pleased with his property ...”
Perhaps surprisingly, given that they were also all slave-owners, the jury disagreed. On Friday 13 September 1839, he was convicted on the charge of murder. An appeal was heard at the North Carolina Supreme Court in Raleigh which upheld the verdict.
John Hoover was executed for the murder of his slave in May 1840.
Details of the case can be found in:
Interestingly, Anthony V. Baker's paper shows how the laws of North Carolina had changed over time. In particular, a 1774 statute which had criminalised the murder of a slave (“willfully and maliciously killing a slave”), but which had also reduced the punishment for such a murder, such that an offender would:
“suffer twelve Months Imprisonment...” for the first offense and back to the more traditional punishment, “suffer[ing] Death, without benefit of Clergy....” for the second.
However, how often these laws were enforced in practice is a different question.
Not only that, but the difficulty in obtaining a conviction should not be underestimated. This was illustrated in the relatively well-known case of Eliza Rowand, who was charged with, & acquitted of, the murder of one of her slaves in 1847.
For a wider view of the question, I'd recommend Andrew T. Fede's recent book: Homicide Justified: The Legality of Killing Slaves in the United States and the Atlantic World. This includes discussions around the issues raised by both of the cases mentioned above, and also includes an entire chapter dedicated to The Antebellum States' Law on Slave Homicide (Chapter 11).
As sempaiscuba has said, it was illegal to kill a slave in the slave-holding states of the United States. Premeditated murder of a slave has always been illegal in the slave-holding states.
However, it was not until December 20th, 1821 that all of the slave-holding states held that the first degree murder of a slave was a capital offense.
Slave law has a long history. Different states had different laws at different times. Massachusetts was the first colony to authorize slavery through enacted law in the 1641 Massachusetts Body of Liberties. Section 91 related to slavery.
There shall never be any bond slaverie villinage or Captivitie amongst us, unles it be lawfull Captives taken in just warres, and such strangers as willingly belie themselves or are sold to us. And these shall have all the liberties and Christian usages which the law of god established in Israell concerning such persons doeth morally require. This exempts none from servitude who shall be Judged thereto by Authoritie.
At this time in Massachusetts slaves had some rights. A study of what "all liberties and Christian usages which the law of god established in Israell concerning such persons" means will have to be taken up in a different question.
As time went on the number of slaves in the United States grew and laws restricting the rights of slaves were put in effect. By 1691 in Virginia
slaves are denied the right to a jury trial for capital offenses. https://www.history.org/history/teaching/slavelaw.cfm
In 1856 George Stroud noted:
There was a time when, in all the old states in which slavery is still maintained, the murder of a slave, whether by his master or a third person, was punished by a pecuniary fine only. South Carolina was the last of these states in which a change in the particular was made. Since then (Dec. 20, 1821) the wilful, malicious and premeditated killing of a slave, by whomsoever perpetuated, is a capital offence in all the slave-holding states.
William Goodell wrote:
In former times, the murder of a slave in most, if not all the slaveholding regions of this country, was by law, punishable by a pecuniary fine only. At present the wilful, malicious, and deliberate murder of a slave, by whomsoever perpetrated, is declared to be punishable with death in every State. The exclusion of all testimony of coloured persons, bond or free, is a feature sufficient of itself to render these laws nugatory.
According to the South Carolina Slave Act of 1740
"To restrain and prevent barbarity being exercised towards slaves, Be it enacted, that if any person shall wilfully murder his own slave, or the slaves of any other person, every such person shall, upon conviction thereof, forfeit and pay the sum of seven hundred pounds, current money, and shall be rendered for ever incapable of holding, exercising, any office. And in case any person shall not be able to pay the penalty and forfeiture hereby inflicted and imposed, every such person shall be sent to any of the frontier garrisons of the province, or committed to work-house in Charleston for the space of seven year at hard labor"
Another provision in the same Act is as follows: "If any person shall, on a sudden heat or passion, or by undue correction, kill his own slave, or the slave of any other person, he shall forfeit the sum of three hundred and fifty pounds, current money"
Even after 1821 unpremeditated murder or correcting a slave to death was punished with a fine.
This act continued in force till 1821, when the wilful murder of a slave was made punishable by death, without benefit of clergy; while the penalty for killing in "sudden heat", or "undue correction," was reduced to five hundred dollars, but authorizing an imprisonment for six months
A much longer answer could go into the details that made getting a conviction, even after 1821, very difficult.
For transparency, both Goodell and Stroud are noted abolitionists. My focus has been on their references to the South Carolina Slave Code rather than their opinions.
For further reference:
Complete text of the 1740 Slave Code of South Carolina. See section 37
West's Encyclopedia of American Law, edition 2. S.v. "South Carolina Slave Code." https://legal-dictionary.thefreedictionary.com/South+Carolina+Slave+Code
Negro Law of South Carolina collected by John Belton O'Neall 1848
Contains the changes from the Act of 1821