The militants were involved in "heinous offences related to terrorism, including abducting and slaughtering of soldiers, attacking law enforcement agencies and armed forces of Pakistan," the army said in a statement.
They were involved in killing 21 persons and injuring another person. Arms and explosives were also recovered from their possession.
The four were identified as Shabbir Ahmed, Umara Khan, Tahir Ali and Aftabud Din.
However, it was not revealed where and when the trial was held as the military courts work in secrecy due to fear of backlash by militants.