Barclay helped Glasgow qualify for the RaboDirect Pro12 play-offs on his 150th appearance for the club as Warriors ran up five tries in victory over Ospreys.
The 26-year-old joined Glasgow in 2004 and has 41 caps for his country.
Barclay told the Llanelli club's official website: "It was an emotional and memorable evening on Friday night in front of a packed home crowd and it was great to get my 150th appearance and bid farewell to supporters on the back of an important win for Glasgow in our stadium.
"I am now really looking forward to moving to the Scarlets next season; having seen the ambition they play with, the style, rugby philosophy and tradition of such a great rugby region, I know that it will be a great move for me.
"I've been lucky to be with Glasgow for nine years and helped take Glasgow to develop into what is now seen as a very competitive side.
"Having been with them all my professional career, to move somewhere new, it had to be to the right club with an environment and philosophy I could relate to and to a team that I could make a difference within."
Scarlets head coach Simon Easterby said: "John is a dynamic player who will offer another added dimension to the existing talent we have in our back row.
"He has shown that he is really at the top of his game since coming back from injury. At just 26, he brings world-class experience yet still has his best rugby years ahead of him."
- Sports & Recreation