The plan by Sharif and Bhutto has increased pressure on Musharraf to end eight years of military rule.
“Musharraf, who moved against Sharif after he tried to replace him as army chief, has vowed to prevent the exiled former leaders from returning”
Send us your views
A presidential vote, due by mid-October, is to be followed by parliamentary elections at the end of the year.
The main opposition parties of Sharif and Bhutto hope to make gains.
Musharraf and Bhutto are currently engaged in talks about a possible power-sharing deal that could help Musharraf gain a new five-year presidential term this autumn.
Musharraf, who moved against Sharif after he tried to replace him as army chief, has said he aims to prevent the exiled former leaders from returning.
On Thursday, a lawyer for Sharif, argued before a Supreme Court bench that his client had an “undeniable, unqualified, fundamental right to remain in Pakistan and contest the forthcoming elections”.
Fakhruddin Ibrahim told government lawyers in the first hearing on a petition filed by Sharif and his brother: “You have no right to send someone abroad, to send someone into exile.”
Musharraf has said he let Sharif out of jail and allowed him to leave Pakistan with his family under an arrangement whereby he would not return for at least 10 years.
On Wednesday, government lawyers gave the court a copy of what it said was the agreement signed by Sharif.
But the document neither mentioned Pakistan’s government nor carried the signature of any Pakistani official – a point seized on by Sharif and his lawyers to contest its validity.
“It has to be ignored,” Ibrahim said.
Two of the seven judges hearing Sharif’s petition asked government lawyers not to describe the exile deal as an “agreement”, but gave no clear indication of how they might rule.
Government lawyers say they cannot prevent Sharif from returning but warn that he could face unspecified legal action when he reaches Pakistani soil.
In a separate development on Thursday, Sohail Rahman, Al Jazeera’s correspondent in Islamabad, reported that Ibrahim Sati, the government’s lead lawyer, said that Pakistan was still under emergency rule.
Emergency rule in Pakistan was imposed after nuclear tests in May 1998.
The remark halted court proceedings for at least 20 minutes.
Iftikhar Mohammed Chaudhury, the Supreme Court’s chief justice who is on the bench hearing Sharif’s appeal, asked the attorney-general to ask his superiors in the government if a state of emergency indeed existed.
The attorney-general came back with the information that Pakistan was not under emergency rule at all.