A presidential vote, due by mid-October, is to be followed by year-end parliamentary elections, where 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 him gain a new five-year presidential term this autumn.
Musharraf, who moved against Sharif after he tried to replace him as army chief, has vowed 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 banished Sharif and his family to Saudi Arabia in December 2000, the year after Musharraf ousted Pakistan's last civilian-led government in a bloodless coup.
Musharraf has said he let Sharif out of jail and allowed him to leave Pakistan 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 mentions Pakistan's government nor carries 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.
Al Jazeera's Sohail Rahman, reporting from Islamabad on Thursday, said a remark by Ibrahim Sati, the government's lead lawyer, that Pakistan was still under emergency rule, imposed after the May 1998 nuclear tests, halted the 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.