In 1941–1942, during the North Africa Campaign, Pienaar fought in the battles of Sidi Rezegh and Gazala. On 10 March 1942, he was promoted to Major-General GOC 1st South African Infantry Division, which he led in the Battle of Gazala, the retreat to Egypt, the defence of El Alamein and the Second Battle of El Alamein. He was twice awarded the DSO and twice mentioned in dispatches for his service in North Africa. He was recorded by the press after El Alamein as saying, "Rommel will not get to Alexandria, he will not get the Canal, and he will never dine in Cairo - unless as a tourist."