This article in Dawn provides some historical background, including case citations:
The issue of military courts had surfaced even during the government of late Zulfikar Ali Bhutto when he had set up summary military courts after the general elections of 1977. During that time law and order had emerged as a result of agitation started by then opposition parties against alleged rigging in the polls. When the governments in Sindh and Punjab failed to control the situation those military courts were set up under Article 245 of the Constitution whereas certain amendments were also made in the Army Act 1952.
That action of the government was challenged before the Lahore and Sindh high courts. The judgments of the two high courts in those petitions are reported as Darwesh M. Arbey vs Federation of Pakistan (PLD 1980 Lahore 206) and Niaz Ahmed Khan vs Province of Sindh (PLD 1977 Karachi 604), respectively. In these judgments the courts clearly pronounced that Article 245 of the Constitution could not be invoked by a political government to rule through the armed forces.
In 1998 the then Nawaz Sharif’s government had invoked Article 245 of the Constitution for calling armed forces in aid of civil power. Similarly an ordinance was promulgated for establishing military courts.
Through the famous judgment in Sheikh Liaqat Ali Case (PLD 1999 Supreme Court 504) a full bench of the Supreme Court, headed by then chief justice Ajmal Mian, had declared as unconstitutional and illegal the setting up of military courts. The judgment clearly demonstrated that the civil authorities as well as the security forces could not act outside the parameters and limits enshrined in the Constitution. However, by the time the judgment was delivered two convicts, who were awarded death sentences by military courts, had already been executed.The Supreme Court will resume hearings on the pending constitutional petitions on Wednesday, April 22.