The 28-year-old will join up with the Guinness Premiership club after the Currie Cup in South Africa in October.
Barry, who has 39 Springboks caps, said: "I am looking forward to the challenge of joining Harlequins and look forward to the new chapter in my rugby career.
"I am sure I will be very happy at Harlequins and intend on making the most of this opportunity."
Barry joined The Stormers in 1998 and has built a reputation as a hard-running centre with a solid defence.
Harlequins director of rugby Dean Richards said: "I'm absolutely delighted to have secured the services of such a quality player.
"He's a formidable defender and a fantastic runner so I expect him to fit into the Guinness Premiership with ease.
"This latest signing further highlights the fact that we are building a squad that has good competition for places and strength in depth."