Five crew members, including two pilots, and 13 civilians were among the dead, according to rescue services.
The Inter-Services Public Relations (ISPR) said in a statement that the aircraft was on a "routine training flight" when the accident occurred early Tuesday in the village of Mora Kalu, adjacent to Rawalpindi.
The plane crashed and set off a massive fire that engulfed several houses in the locality. At least 13 civilians were also injured.
The military's media wing did not specify the type of aircraft involved in the crash. It identified the deceased Army personnel as Lt. Col. Saqib (pilot), Lt. Col. Waseem (pilot), Naib Subedar Afzal, Havaldar Ibne Ameen and Havaldar Rehmat.
The ISPR added that rescue teams from the Pakistan Army and Rescue 1122 reached the crash site and shifted the injured to nearby hospitals and extinguished the fire.
"We have taken 18 bodies to the hospital… that included 13 civilians and five crew members," rescue services spokesman Farooq Butt was quoted as saying by the Express Tribune.
"All the bodies are badly burned, so DNA tests are required for identification," he added.
Witnesses at the scene said the aircraft crashed into a house. "I was awake when the plane flew over my room and it was already on fire in the air," said resident Ghulam Khan. "The sound was so scary, it was only a small plane. It then fell on a house where a family used to live."
Another witness, Yasir Baloch, said: "The tail of the plane was on fire and it took barely two to three seconds and it crashed four houses away from my house and burnt to ashes."
A resident near the site of the crash who gave his name as Yamin said he had escaped from his burning house with his wife, daughter and parents, but his brother, sister-in-law and nephew died.
President Arif Alvi and Prime Minister Imran Khan expressed grief over the loss of lives.
In another major air disaster in 2016, a Pakistan International Airlines plane burst into flames after one of its two turboprop engines failed while travelling from northern Pakistan to Islamabad, killing more than 40 people.
The deadliest air disaster on Pakistani soil was in 2010 when an Airbus 321 operated by private airline Airblue and flying from Karachi crashed into the hills outside Islamabad while coming in to land, killing all 152 onboard.