The centre-half, whose Bristol City deal was up at the end of last month, has signed a two-year contract.
The move takes Nyatanga back to Oakwell, where he spent three loan spells earlier in his career during his time as a Derby player.
He becomes David Flitcroft's latest summer signing following deals for Dale Jennings, Chris O'Grady and Christian Dibble.
Nyatanga, 24, told the club website: "I've got really fond memories of my time here.
"I've spoken with the manager and he's so passionate about what they're trying to do here.
"I've bought into that and I'm coming here with a lot of motivation to help push this club up."