Petersen was born and raised in the township of Gelvandale in Port Elizabeth and attended the same state high school as fellow South African Test batsman Ashwell Prince. His father was a taxi driver. He started playing first class cricket in 2001, representing the Northerns cricket team. He played for South Africa A before breaking into South Africa's ODI squad in 2006, playing in two matches against Zimbabwe. He made his Test debut in February 2010 against India in Kolkata, and he scored a century. He is the third player to score a century on Test debut for South Africa, after Andrew Hudson and Jacques Rudolph. Later in 2010, Petersen played for Kings of Khulna in Bangladesh's NCL Twenty20 tournament. He also played in the three Tests of South Africa's tour of the West Indies, the two Tests of the series against Pakistan in the United Arab Emirates, and all three Tests of the drawn home series against India. He failed to score a century in any of the three series, and was dropped for South Africa's two-Test home series against Australia in November 2011. Meanwhile, Petersen signed for Glamorgan County Cricket Club for the 2011 English county season, replacing Jamie Dalrymple as the county's captain. Petersen was Glamorgan's top run scorer in every competition. He scored his first double hundred in first class cricket against Surrey at the Oval and was named Glamorgan's player of the year. He returned to South Africa at the end of the county season to play for the Highveld Lions. After a string of high scores, he was recalled to South Africa's side for the third Test of the home series against Sri Lanka, replacing the dropped Ashwell Prince. Opening the batting in the first innings, he scored his second Test century. On 13 February 2012, Essex confirmed Petersen will join the club for the first half of the county season. Petersen could not rejoin Glamorgan as a Kolpak player as he won his place back in the South Africa Test team at the start of 2012. Petersen commented that he wished to stay at Glamorgan: "My agent gave Glamorgan a proposal which they didn't accept... can only sign one overseas ... We proposed something but rejected... Just to put the record straight, I enjoyed my time with Glamorgan, and yes, would have wanted it to continue" He left Essex 31 May 2012. In July/August 2012 Petersen opened the batting for South Africa in their three match series in England, scoring 182 in the drawn second test at Headingley. Petersen was given out twice in this innings but was saved on both occasions by the Decision Review System. Petersen joined Somerset as their overseas player for the first part of the 2013 season. On 31 October 2013, Petersen re-signed for Somerset to be their overseas player for the 2014 season. On 6 January 2015, following South Africa's victory in the third Test against the West Indies, Petersen announced his retirement from international cricket and that he would take up a Kolpak deal in English county cricket. Petersen subsequently signed a two-year contract with Lancashire, on 22 January 2015. In December 2016, Petersen was banned from cricket for two years by Cricket South Africa after his involvement in match-fixing in the 2015–16 domestic T20 competition.