The Los Angeles Galaxy footballer appeared while 60 members of the public were taking part in a photo session with Adidas.
The fans were sporting the Team GB Olympic kits inside a set-up photobooth in the Westfield Stratford City shopping centre, near the Olympic Park.
During each shoot, Beckham suddenly appeared around the corner, much to the surprise of the participants.
Beckham said: "It was a unique experience for me and the people who took part and there were some great reactions when we surprised them in the photobooth.
"I always love coming back to London and the activity was a great opportunity for me to get involved in the Adidas Take The Stage campaign and get behind Team GB."
Schoolboy Christian Lewis burst into tears when his hero suddenly appeared during his turn. The footballer gave him a hug while the boy's mother also looked on in surprise.
David Beckham has not been selected for the Team GB football squad, but he is still rumoured to be part of the opening ceremony on Friday (July 27).