The Sherlock star will feature in Steve McQueen's forthcoming historical drama, reports Variety.
The film tells the story of Solomon Northup, a free black man living in New York in the 1840s who is kidnapped and sold into slavery on a Louisiana plantation.
Cumberbatch will take the role of a slave owner who is slowly won over by Northup's engineering skills.
Chiwetel Ejiofor will play Northup alongside a cast featuring Adepero Oduye, Michael Fassbender, Brad Pitt, Taran Killam, Scoot McNairy, Ruth Negga and Paul Dano.
Twelve Years a Slave was originally published as a memoir of Northup's time in slavery in 1853.
Cumberbatch will play the role of a villain in Star Trek 2, although rumours continue to fly concerning the character he will portray.
Twelve Years a Slave is scheduled for a 2013 release.
Watch Benedict Cumberbatch and Mark Gatiss talking to Digital Spy at the BAFTAs below: