Hafeez will travel to Dubai to join the team, a spokesperson for the Pakistan Cricket Board (PCB) said on Monday.
Pakistan will play its first test from October 7-11 in Dubai followed by a second test from October 16-20 in Abu Dhabi.
Last week, Pakistan announced its squad, dropping left-arm pacer Mohammad Amir and recalling seamer Wahab Riaz.
Skipper Sarfraz Ahmed will be backed up as wicketkeeper by Mohammad Rizwan, who played his sole test against New Zealand in Hamilton almost two years ago.
“The team has been selected keeping in mind the conditions in the UAE, where Mohammad Amir has been dropped from the side and Wahab Riaz and Mir Hamza come in,” Pakistan chief selector Inzamam-ul-Haq said in a statement.
“Three spinners: Shadab Khan, Yasir Shah and Bilal Asif have been kept in the squad, keeping in view the UAE wickets.”