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.

David Cameron told the Conservative leader of Oxfordshire County Council, Ian Hudspeth, that potential reductions in services were unwelcome.
He suggested cuts in back office functions instead and offered to set up a meeting with the No 10 policy unit.
Labour has asked the Cabinet Secretary if that broke the ministerial code.
The PM wrote to Oxfordshire council leader Ian Hudspeth last month saying he was "disappointed" at proposed "cuts to frontline services, from elderly day centres, to libraries, to museums".
The council should "move cautiously in setting out its budget plans", he says.
In a letter of response Mr Hudspeth reminds Mr Cameron he "worked hard to assist you in achieving a Conservative majority".
Mr Cameron is the MP for Witney in Oxfordshire, an area covered by Oxfordshire County Council.
Labour has written to Cabinet Secretary Sir Jeremy Heywood suggesting the prime minister's letter may have breached the ministerial code, because Mr Hudspeth was invited to meet the No 10 policy unit regarding budget cuts.
Shadow minister without portfolio Jon Ashworth said the code requires ministers to "keep separate their roles" in government and as constituency members.
He said the leader of Mr Cameron's constituency county council "should not be given preferential treatment", and asked whether similar offers have been made to all the leaders of other councils.
Mr Ashworth told BBC Radio 4's Today:  "I doubt he is inviting the leader of Leicester City Council, where I am an MP, or the leader of Manchester City Council into the No 10 policy unit to discuss ways to deal with the cuts.
"It feels like a breach and I hope the Cabinet Secretary will look into it."
In his letter, the prime minister attempts to reassure his local colleague, pointing out that the money councils get from central government will not be confirmed until after the Spending Review later this month.
In his lengthy letter of response, Mr Hudspeth disagrees with a series of claims made in the prime minister's letter - including a suggestion that Oxfordshire County Council was failing to make back office savings and had actually seen an increase in its budget.
The county council leader points out that the authority employs almost 3,000 fewer people than it did in 2010.
He adds that the council's grants from government have fallen from £194m a year in 2009/10 to £122m this year.
"I cannot accept your description of a drop in funding of £72m... as a 'slight fall'" he writes.
Mr Hudspeth points out that in addition to the spending cuts the council has had to deal with, the demands upon it have been growing, given the "heightened awareness and concern around vulnerable children" since the Baby P case in Haringey in north London, and "the growth in the elderly population - who generate the largest demand for expensive social care placements and support".
Oxfordshire County Council's cabinet agreed earlier this week to cut £3.7m in subsidies to bus companies in the county. The subsidies currently help ensure "low use routes" remain viable.
Such routes are often in rural areas - such as the prime minister's Witney constituency.
A spokeswoman for the prime minister said: "There is still significant scope for sensible savings across local government to be made by back office consolidation, disposing of surplus property and joining up our local public services; we will be discussing with Oxfordshire how this can be taken forward to help protect frontline services."
For Labour, shadow chancellor John McDonnell told the BBC on Wednesday: "I welcome the prime minister as another Tory MP joining our campaign against George Osborne's cuts."
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.
[NEXT_CONCEPT]
Labour has accused David Cameron of being hypocritical by writing to his local council in Oxfordshire to complain about proposed cuts.