What degree of choice did chattel slaves in the United States of America1have over their sexual autonomy?
Was this codified in any law?
1. Assuming scope is the USA, given the source of the Roots TV series, stated by the OP.
The short answer is: None at all.
According to the "Incidents in the Life of a Slave Girl" by Harriet Jacobs:
Female Slaves and the Law
Southern rape laws embodied race-based double standards. In the antebellum period, black men accused of rape were punished with death. White men could rape or sexually abuse female slaves without fear of punishment. Children, free women, indentured servants, and black men also endured similar treatment from their masters, or even their masters' children or relatives. While free or white women could charge their perpetrators with rape, slave women had no legal recourse. Their bodies technically belonged to their owners by law. The sexual abuse of slaves was partially rooted in a patriarchal Southern culture which treated all women, black and white, as property or chattel.
Beginning in 1662, Southern colonies adopted into law the principle of partus sequitur ventrem, by which children of slave women took the status of their mothers, regardless of the father's identity. This was a departure from English common law as it applied to English subjects, which held that children took their father's status. Some slave owner fathers freed their children, but many did not. The law relieved men of the responsibility of supporting their children, and confined the "secret" of miscegenation to the slave quarters.
The belief in racial "purity" drove Southern culture's vehement prohibition of sexual relations between white women and black men, but this same culture essentially protected sexual relations between white men and black women. The result was numerous mixed-race children. The children of white fathers and slave mothers were mixed-race slaves whose appearance was generally classified as mulatto (this term at first meant a person with white and black parents, but grew to encompass any apparently mixed-race person).
Many mixed-race families dated back to colonial Virginia, in which white women, generally indentured servants, produced children with men of African descent, both slave and free. Because of the mother's status, those children were born free and often married other free people of color.
Slave breeding refers to those practices of slave ownership that aimed to influence the reproduction of slaves in order to increase the profit and wealth of slaveholders. Such breeding was in part motivated by the 1808 federal ban on the importation of slaves, and in light of western competition in cotton production. Slave breeding involved coerced sexual relations between male and female slaves, sexual relations between master and slave with the intention to produce slave children, and favoring female slaves who produced a relatively large number of children.
Under slavery, slaveholders owned, controlled, and sold entire families of slaves. Slave owners might decide to sell families or family members for profit, as punishment, or to pay debts. Slaveholders also gave slaves away to grown children or other family members as wedding settlements. They considered slave children ready to work and leave home once they were 12-14 years old.
Concubines and Sexual Slaves
Some female slaves called "fancy maids" were sold at auction into concubinage or prostitution, which was termed the "fancy trade. " Concubine slaves were the only class of female slaves who sold for higher prices than skilled male slaves.
In the early years of the Louisiana colony, French men took wives and mistresses from among the slaves. They often freed their mixed-race children and sometimes the mistresses themselves. A considerable class of free people of color developed in and around New Orleans and Mobile. By the late 1700s, New Orleans had a relatively formalized system of plaçage among Creoles of color, which continued under Spanish rule. Mothers negotiated settlements or dowries for their daughters to be mistresses to white men. The men sometimes paid for the education of their children, especially their sons, whom they sometimes sent to France for schooling and military service.
Relationship of Skin Color to Treatment
In many households, the slave treatment with the slave's skin color. Darker-skinned slaves worked in the fields, while lighter-skinned slaves worked as house servants and had comparatively better clothing, food, and housing. Sometimes, as in President Thomas Jefferson's household, planters used mixed-race slaves as house servants or favored artisans because they were their own children or the children of relatives. Six of Jefferson's later household slaves were the grown children of his father-in-law John Wayles and Wayles' mistress Betty Hemings. Jefferson's wife Martha inherited them along with Betty Hemings and other slaves a year after her marriage to Jefferson, following the death of her father. At that time, some of the Hemings-Wayles children were very young; Sally Hemings, who many believe to have later become Jefferson's mistress after the death of his wife, was an infant at the time of Martha's inheritance. They were trained as skilled domestic servants and occupied the top of the slave hierarchy at Monticello.
The Slave Codes were individualized to each State, but none that I could find referenced sexual autonomy, or even directly concerned themselves with sex of any kind. They were more concerned with the ownership rights and responsibilities and controlling the possibility of insurrection or rebellion by slaves against the White Establishment.
Where sexual (abuse) was codified was in the unequal laws as written for things such as rape. The rape laws, however, were actually much worse in the Southern states, than you might imagine. Slaves were the property of their owners. Period. This way of thinking, more or less, translated into any White man could do as he pleased with any slaves.
Any slave found guilty of arson, rape of a white woman, or conspiracy to rebel was put to death. However, since the slave woman was chattel, a white man who raped her was guilty only of a trespass on the master's property. Rape was common on the plantation, and very few cases were ever reported.
Slave Life and Slave Codes
When it came down to the brass tacks, though, any White man could take a slave by force and never face charges of rape. It simply wasn't. Any White woman could (and would) charge a black rapist as such. In fact, a Southern White Belle, with a Negro lover even of long time, if found out in a way sure to embarrass, would simply accuse the slave of rape and the man would be put to death.
The sticky wicket, however, was that no White Southern Gentleman could (or would) be charged with rape of any woman, of any race or slave status. Were a White man to sexually assault a White woman, he wouldn't be convicted (or even charged) with rape. He might be made to pay (whether monetarily, or by perhaps a forced marriage or out of hide) by the relatives of the woman involved and only if they were well connected. If a sharecropper's daughter were taken sexually by a Gentleman, no one would even take notice. Definitely no actual charges would be filed or accepted, for no crime had been committed.