Cameron praised the soldier for being "on his marks" as he walked to Downing Street after using the London Underground to visit the Olympic Park in Stratford.
Cameron told ITV London Tonight: "I was stopped going down Whitehall by a soldier. I didn't have my papers."
Organisers have turned off some of the Olympic road lanes reserved for VIPs because officials are travelling by public transport, London Mayor Boris Johnson said.
He said even International Olympic Committee President Jacques Rogge took the Docklands Light Railway instead of a car.