The pair will meet if both progress to the last eight of the penultimate Masters 1000 tournament of the season.
With both men having a first-round bye, Djokovic will open his campaign against either Marcel Granollers or fellow Serb Janko Tipsarevic, while fifth seed Federer must play either wild-card entry Lleyton Hewitt or Andreas Seppi.
"It is always a tough draw here because it is always such a strong tournament being an ATP Masters 1000," said Federer at the draw ceremony.
"It's a difficult first match for me. It would be great to play Lleyton, we go back a long way and I remember playing him in Shanghai when the first Masters Cup was here, he beat me in the semi-finals and went on to win the tournament. We have had some amazing matches. Even if I play Seppi, that will also be tough because he is a very good player."
Third seed David Ferrer and Jo-Wilfried Tsonga are seeded to play the other quarter-final in the top half of the draw.
Rafael Nadal, who will return to the world number one spot on Monday for the first time in more than two years, is seeded to meet Stanislas Wawrinka in the last eight before a meeting with Tomas Berdych in the semis.
However, Berdych is an injury doubt having been forced to quit his match with Nadal in Beijing on Saturday. That could open the door for Juan Martin Del Potro in that section of the draw.
Nadal's opening match will be against either Alexandr Dolgopolov or a qualifier.
British star Andy Murray, who lost in last year's final to Djokovic, is absent as he continues to recover from recent back surgery.