The 22-year-old ex-West Ham youngster made only six appearances for the Tykes after joining last summer.
He previously played for the Hatters on loan from West Ham, scoring three goals in 11 matches during a loan in 2014-15.
The son of former Newcastle midfielder Rob Lee joins his brother Olly, who is already at Kenilworth Road.
"I'm looking forward to playing with Olly. He was a big factor in me coming here. Having been here and known all the lads, I'm really looking forward to it," he said.
"Olly and I spoke about it and we realised it would be a great experience to play together and something we'd enjoy. It's something special for the family."
Lee makes the opposite move to midfielder Cameron McGeehan, who left Bedfordshire to join Barnsley last month.
Find all the latest football transfers on our dedicated page.
Luton Town have made forward Elliot Lee their seventh addition of the summer after signing him on a two-year deal following his release by Barnsley.