The guard, identified only as Nematullah, was one of two guards giving testimony in a hearing intended to determine whether there is sufficient evidence to court-martial Staff Sgt. Robert Bales for the March massacre.
"I was shocked and also I was nervous," Nematullah testified through an interpreter. "I can't believe that the guy was coming this way."
He said he briefed another guard who came on duty to relieve him about what he had seen. The second guard, Tosh Ali, testified he saw a U.S. soldier leaving the base a short time later.
The two guards testified Friday night by video from Afghanistan, the Los Angeles Times reported.
Army prosecutors allege Bales, 39, left Camp Belambay in Kandahar province twice the night of March 11 to kill residents of the villages of Alkozai and Najiban.
Prosecutors said the slayings were retaliation for an improvised explosive device attack several days earlier on a detachment of Army special forces troops.
Bales faces 16 counts of premeditated murder and six counts of attempted murder, along with alcohol and drug charges. If convicted of the murder charges, he could face the death penalty.
Prosecutors said Bales was covered in blood and carrying a rifle, a 9-milimeter pistol and a grenade launcher when he was arrested returning to camp about 4:30 a.m.
Beautician charged with giving client fatal silicone butt injection
Ohio bar shooting arrested, charged with murder