The quip came as the president congratulated Beckham and his Los Angeles Galaxy team-mates, who defeated the Houston Dynamo last November to clinch the 2011 MLS Cup.
"It is a rare man who can be that tough on the field and also have his own line of underwear," Obama said with a smile to laughter from the audience.
Beckham's fame transcends the football pitch. He has landed endorsement deals with Adidas and Pepsi, and is known for showing off his body in underwear ads for H&M. His wife, Victoria, is a former member of the Spice Girls, one of the most successful bands of the 1990s.
Obama joked about the veteran's age. The 37-year-old has a good number of years on most of his team-mates.
"I have to say I gave David a hard time - I said half his team-mates could be his kids," the president said. "We're getting old David, although you're holding up better than me."
Obama also had a line for Ireland striker Robbie Keane, who joined the Galaxy in January.
"Robbie arrived halfway through last season," said Obama, "scored his first goal in the first 21 minutes of his first game. His team-mates were so happy to have him that they filled his locker with what they called the 'pleasures of Ireland' - Guinness, Baileys, and Irish Spring."
"Hopefully Robbie has broadened their horizons a little bit since then," he added.