Musharraf, who seized power in 1999 and left the country after stepping down in 2008, has vowed to return home on Sunday to contest the May 11 general election, but is wanted in Pakistan for conspiracy to murder and illegally arresting judges.
To preclude the prospect of his arrest on arrival, his daughter, Ayla Raza, petitioned a court in Karachi on his behalf for protective bail.
"He has been given pre-arrival, protective bail in all three cases," Musharraf's lawyer Ahmad Raza Kasuri told AFP.
Judge Sajjad Ali Shah posted bail at 300,000 rupees ($3,000) over the 2007 sacking of judges, the 2006 death of Akbar Bugti, a Baluch rebel leader in the southwest and the 2007 assassination of Benazir Bhutto.
The decision means that Musharraf cannot be arrested for 10 days in connection with the judges' arrests and for 14 days in connection with the other two cases.
"He has full protection now and he cannot be arrested in these cases upon his arrival in Pakistan," Salman Safdar, another Musharraf lawyer, told AFP.
After the court decision, a handful of activists from Musharraf's All Pakistan Muslim League (APML) party flashed victory signs and chanted "Long Live Musharraf" and "Musharraf will come back, he will bring prosperity".