The 32-year-old all-rounder returns after missing last December's tour of India. He has been included mainly for his leg-spinning ability rather than his batting prowess - and has been warned by chief selector Iqbal Qasim that this series represents his last chance to impress.
"He (Afridi) played against Afghanistan. Basically we wanted to assess his fitness and he is fully fit," Qasim said on www.cricinfo.com.
Qasim added: "They (South Africa) are playing well against fast bowling and our pacers are struggling, so having variety in spin will prove beneficial. The decision to pick Afridi is based on his quality of right-arm leg spin.
"I am not saying go and play him in the XI. My mind says we have to have some variety. Our task is to select the best lot to play against South Africa and Afridi has a role to play with his variety in his bowling."
Batsman Asad Shafiq and spinner Abdur Rehman have also been named in the ODI group, with Anwar Ali, Azhar Ali, Haris Sohail and Zulfiqar Babar missing out from those who toured India. Wahab Riaz replaces Sohail Tanvir in the Twenty20 party.
The two T20 internationals take place on March 1 and 3 in Durban and Centurion before the first ODI on March 10 in Bloemfontein.
ODI squad: Misbah-ul-Haq, Mohammad Hafeez, Nasir Jamshed, Asad Shafiq, Younis Khan, Shoaib Malik, Kamran Akmal, Umar Akmal, Shahid Afridi, Saeed Ajmal, Mohammad Irfan, Junaid Khan, Wahab Riaz, Umar Gul, Imran Farhat, Abdur Rehman.
T20 squad: Mohammad Hafeez, Nasir Jamshed, Shoaib Malik, Kamran Akmal, Umar Akmal, Shahid Afridi, Saeed Ajmal, Mohammad Irfan, Wahab Riaz, Umar Gul, Ahmed Shehzad, Umar Amin, Zulfiqar Babar, Asad Ali, Junaid Khan.