U.S. intelligence agencies, it said, had been tracking them and shared their shifting across to Pakistan on October 11, 2017 through Kurram Agency border.
Joshua Boyle, a Canadian, boarded a flight in Islamabad with his American wife Caitlan Coleman and their three children, the military source with direct knowledge of the arrangement told CNN.
Coleman's parents told the online Circa News service that they received a letter from their daughter in November 2015, in which she wrote that she'd given birth to a second child in captivity.
Pakistan Army announced on Thursday the hostages had been "recovered. from terrorist custody through an intelligence-based operation by Pakistani troops".
The rescue came as Pakistan and the United States, uneasy allies in fighting Taliban and other militant groups in the region, are experiencing one of the worst lows in relations.
The last time anyone heard from Coleman, the York County native spoke of the "Kafkaesque nightmare" she and her husband had been trapped in for almost five years.
A second Pakistani security official, speaking on condition of anonymity, said US drones had been circling the town of Kohat, on the edge of the tribal areas on Wednesday, suggesting U.S.co-operation included sophisticated surveillance inside Pakistan. USA officials did not confirm the details. Thursday's statements from Islamabad and Washington were the first mention of a third child.
Traders Sell Anheuser-Busch Inbev SA (BUD) on Strength (BUD)
The average twelve-month target price among brokers that have updated their coverage on the stock in the past year is $124.62. ANHEUSER-BUSCH INBEV (1NBA.DE) now has a 50-day moving average of 100.39, the 200-day is at 101.48, and the 7-day is 104.03.
"Canada has been actively engaged with the governments of the United States, Afghanistan and Pakistan, and we thank them for their efforts, which have resulted in the release of Joshua, Caitlan and their children", Freeland said in the statement.
Boyle was once married to Zaynab Khadr, the older sister of former Guantanamo Bay detainee Omar Khadr and the daughter of a late senior al-Qaida financier.
They were pictured holding their two young sons, who had been born while they were in captivity.
Ms Coleman, 32, was seven months pregnant when she and her Canadian husband, Josh Boyle, 34, were abducted in Afghanistan 2012 and held by the Haqqani network - a group with ties to the Taliban.
"They were captured by terrorists from Afghanistan in 2012 and kept as hostages there", the ISPR said.
US Special Operations forces conducted a secret raid authorised by then-president Barack Obama to rescue them, but the hostages were not there, the Pentagon said at the time.
They would appear sporadically in videos from the Haqqani network over the years, saying their captors had threatened to kill them if the Afghan government would not stop executing Taliban prisoners.