First word of the injury came in a statement from press secretary Robert Gibbs nearly three hours after the incident.
The White House did not initially name the person who caused the injury, but identified him later Friday as Rey Decerega, director of programs for the Congressional Hispanic Caucus Institute.
Obama received the stitches under local anesthesia in the doctor's office on the ground floor of the White House after returning home. Doctors used a smaller filament than typically used, which increases the number of stitches but makes a tighter stitch and leaves a smaller scar.
The president had gone to nearby Fort McNair to indulge in a game of basketball, one of his favorite athletic pursuits. It was a five-on-five contest involving family and friends. Among the players were Obama's nephew, Avery Robinson, Education Secretary Arne Duncan and Reggie Love, Obama's personal assistant, who played at Duke University.
The White House said the injury happened during their fifth and final game when Decerega turned to take a shot and hit Obama, who was playing defense, in the mouth with his elbow.
Obama emerged from the building after about 90 minutes of play, wearing a short-sleeve T-shirt and gym pants, and was seen dabbing at his mouth with what appeared to be a wad of gauze. A few hours later, reporters who had gathered on the White House driveway for the arrival of the Christmas tree saw the president in an upstairs window, pressing an ice pack against his mouth before he stood and walked away.
"After being inadvertently hit with an opposing player's elbow in the lip while playing basketball with friends and family, the president received 12 stitches today administered by the White House Medical Unit," Gibbs said.
Decerega issued a statement through the White House late Friday. He did not immediately respond to an e-mail request from The Associated Press for independent comment.
"I learned today the president is both a tough competitor and a good sport," the statement said. "I enjoyed playing basketball with him this morning. I'm sure he'll be back out on the court again soon."
Obama's motorcade obeyed all traffic stops, the custom for nonofficial trips, during the return to the White House.
In February, Obama, 49, was deemed to be in excellent health and fit for duty after his first medical checkup as president. Doctors reported then that Obama had yet to kick a smoking habit, takes anti-inflammatory medication to relieve chronic tendinitis in his left knee and should make dietary changes to reduce his cholesterol levels.
Obama was told to return for another physical exam in August 2011, after he turns 50. In addition to regular pickup basketball games, Obama is also an avid golfer.
Obama had no public events scheduled during the long holiday weekend.
His stitched lip, however, could make for some interesting small talk on Tuesday, when Obama is to meet with the congressional leadership. The session originally was announced for Nov. 18, but was delayed after Republicans, who will control the House and increase their numbers in the Senate come January, said they couldn't accommodate the president.
Medical help is always nearby for U.S. presidents. A doctor or nurse is stationed at the White House around the clock and accompanies the president in his motorcade and aboard Air Force One.