The wife, one of three of Bin Laden's wives held after Monday's raid, said she had not ventured outside one room over that time, the official added.
The official said 13 children had also been recovered from the compound.
Bin Laden was killed in a US special forces raid on the compound late on Sunday.
He was believed to have been the mastermind of the 9/11 attacks in 2001 and many others.
The senior Pakistani military official, who asked not to be named, said they had detained Bin Laden's three wives, one of who was Yemeni, after the operation by US special forces in Abbottabad.
"She [the Yemeni-born wife] told us that she came out of that room after five years and that her husband was with her during that duration," the senior official said.
He did not clarify whether the wife had said that Bin Laden had stayed in the compound continuously like her, or ventured out.
She told officials she was shot during the raid and fell unconscious, and that at that point, Bin Laden had been alive.
She said that later on, her daughter had told her she had witnessed her father being shot.
The Pakistani army also recovered 13 children from the compound - two girls and 11 boys - although they have not yet been able to establish how many are Bin Laden's children.
They are all being held in secret locations, the official said.
A wife of Osama Bin Laden has said he had been living in the compound in Abbottabad for five years, a Pakistani military official has told the BBC.