The towering fast bowler retired from international cricket this month after helping South Africa seal their first home Test series victory over Australia since their apartheid-enforced exclusion.
Morkel, 33, took 309 wickets in 86 Tests at an average of 27.66 and was a member of the South Africa side that topped the International Cricket Council's Test rankings in 2012.
He will now be available to play for Surrey, whose headquarters are at The Oval in south London, in all forms of the game as a Kolpak-registered player until the end of the 2019 English season.
"I've got fond memories of playing at the Kia Oval (with South Africa) and am looking forward to settling into London with my family for the summer, making new friendships with team-mates and hopefully great memories on and off the field."
Alec Stewart, Surrey's director of cricket, added: "Following his retirement from international cricket I am very pleased that Morne has signed for Surrey for at least the next two years.
"He has had an outstanding career with South Africa and is a player that will add enormous strength and experience to our squad. His appetite to continue playing and most importantly performing was very evident from our very first conversation."
The former England captain added: "He sets exceedingly high standards for himself and for our young bowlers to have the opportunity to train and play alongside Morne can only help to develop their own games.
"We look forward to welcoming Morne and his family to the Kia Oval for the start of the season."
The Kolpak ruling allows counties to employ foreign cricketers who comply with its regulations as 'home' players.
It came into force in 2003 when the European Court of Justice ruled that anyone with a work permit from a country which has an associate trading agreement with the European Union had the same rights as a European worker.
The ruling originally related to Slovakian handball player Maros Kolpak who was released from his German club because of a quota on non-EU players. He claimed it was unfair and the court ruled in his favour.
A player becomes eligible for a Kolpak deal when he gives up the right to play for his country -- as Morkel has done by retiring from international duty -- and is not classed as an overseas-player signing.
The 2018 English County Championship season starts on Friday, with Surrey opening their First Division campaign at home to border rivals Hampshire at The Oval on April 20.