A 17-member bench of the apex court dismised the petitions against the military courts in a majority 11-6 vote. Justice Nasirul Mulk and Justice Dost Muhammad announced the verdict.
The bench also dismissed petitions challenging the 18th amendment with 14-3 majority vote.
The judgement was announced by the full court bench headed by Chief Justice Nasirul Mulk.
The Parliament passed the 21st Amendment and amended the Pakistan Army Act, 1952, to establish the special courts after massacre by terrorists in Army Public School, Peshawar, on December 16 last year.
The hearing of petitions challenging the 18th and 21st amendments was completed by the Supreme Court on June 26.
A total of 31 constitutional petitions were taken up by the court, of which 16 petitions were challenging 18th amendment and the remaining were about 21st amendment.