Both champions are gold medallists in doubles (Serena won twice with sister Venus), and both face potentially tough first rounds. Federer plays Colombian Alejandro Falla, who pushed Federer to five sets before losing in the first round at Wimbledon in 2010. Former No. 1 Jelena Jankovic of Serbia awaits Williams in her opener.
The draw was held Thursday, two days ahead of the event.
Federer regained the No. 1 ranking with the Wimbledon victory, elevating his Grand Slam title haul to 17. He won the doubles in 2008 with fellow Swiss player Stanislas Wawrinka.
"He is the favourite whenever he plays," said Falla, who describes this season as his strongest yet. "I know him well and he knows me well too.
"I'm going to have to play my best tennis if I am going to have a chance to win, but he's Roger and he's just won Wimbledon for the seventh time here."
Second-ranked Novak Djokovic of Serbia, the bronze medallist at the Beijing games in 2008, was drawn into the same half as Wimbledon finalist Andy Murray, meaning the pair could meet in the semifinals. Djokovic plays Fabio Fognini of Italy in the first round, ahead of a possible second-round match against American Andy Roddick.
Olympic gold medallist Rafael Nadal pulled out because of a knee injury, leaving No. 4 seed David Ferrer as the highest-ranked Spaniard in the Olympic draw.
Albert Costa, sports director of the Spanish Tennis Federation, said the best-of-three set format for the men was "exciting" because it differed from the usual Grand Slam format in which the men have to win three out of five sets. At the Olympics, only the men's final will have the longer format.
"They are normally used to playing five sets but here it will be special conditions," Costa said. "For sure, the matches will all be very, very close."
Serena Williams could meet No. 1 Victoria Azarenka of Belarus in the semifinals. In the other half of the women's draw, Wimbledon finalist Agnieszka Radwanska of Poland and No. 3 Maria Sharapova, who completed a career Grand Slam by winning the French Open this year, could face each other in the penultimate round.
The Williams sisters are unseeded in the women's doubles. They won the event in 2000 and 2008.
No. 8 seed Caroline Wozniacki said the courts at Wimbledon looked "surprisingly good" compared to their state during Grand Slam play a few weeks ago.
"There are a few they are not using, like Court Three, because it is very bouncy and it is just not ready but, generally, it is incredible what they have managed to do with the courts in such a short period of time," said Wozniacki, who plays Briton Anne Keothavong in the first round.
Tennis, with the exception of the mixed doubles event, returned to the Olympics at the 1988 games in Seoul, South Korea after a 64-year hiatus. Mixed doubles is being reintroduced at the London Games; the draw will be held on Tuesday.