Lascelles, 23, has scored three goals in 47 games to help the Magpies gain promotion back to the Premier League.
He missed the win at Cardiff City last week to prepare for the surgery which will take place on Tuesday.
The former Nottingham Forest centre-back will return for Newcastle's pre-season training on 2 July.
United's season-closing game against the Tykes could bring the Championship title to St James' Park, if they can better the result of Brighton, who are one point ahead, at Aston Villa.
Newcastle United captain Jamaal Lascelles will miss Sunday's final game of the season against Barnsley, as he recovers from a groin operation.