The 25-year-old, who has also played for the likes of Brighton and Nottingham Forest, has been with Villa since he was a teenager.
“We’re really pleased with the signing of Gary,” said Barnsley manager Paul Heckingbottom.
“He’s an important addition to give us greater flexibility within the squad and we look forward to working with him. He is going to help us this season and we’re definitely looking forward to that as well.
“I would like to thank Aston Villa for allowing Gary to come here.”
Earlier, Barnsley announced chairman Maurice Watkins is to step down from his role at the club.
Watkins, a former director at Manchester United, was appointed at Oakwell by club owner Patrick Cryne in May 2013.