Djokovic, the No. 2 seed from Serbia, beat Portugal's Joao Sousa 6-1, 6-4, 6-3 while Nadal, the fourth seed from Spain, defeated Robin Haase of the Netherlands 6-1, 6-4, 6-3.
Djokovic is trying to become the first man in the Open Era to capture each of the four Grand Slams twice. Last year, Djokovic won his first Roland Garros title to complete his career Grand Slam.
"Generally I felt better than the first round, so that's exactly what I wanted," Djokovic said after Wednesday's match.
The win is Djokovic's second with new coach Andre Agassi on hand.
"I think I have reached the stage of my life where I just need to always find new ways of motivating myself, inspiring myself, and having Agassi on board and doing some changes is definitely bringing me that," Djokovic said. "I look forward to whatever life brings next. I still feel young in my mind, in my body as well. I'm going to keep going and see where it takes me."
Djokovic will next face Argentina's Diego Schwartzman, who stopped Stefano Napolitano of Italy 6-3, 7-5, 6-2.
Nadal was pleased with his performance in his quest for a 10th Roland Garros title in Paris.
"I'm very happy to come back on the Court Philippe Chatrier," said Nadal, who finished with 33 winners to 13 unforced errors, breaking Haase five times.
Nadal is trying to become the first player in the Open era to win 10 titles at a major after having to withdraw last year ahead of his third-round match because of a wrist injury.
"It was really hard for me last year," Nadal said. "I'm very happy to be back on this court, which is probably the most important in my career."
Next up for Nadal will be Nikoloz Basilashvili, who reached the third round at Roland Garros for the first time by defeating Viktor Troicki 7-6 (3), 7-6 (2), 7-6 (6). Basilashvili, from the country of Georgia, is ranked No. 63 in the world.
American Steve Johnson, still grieving the recent death of his father, advanced to the third round by beating Borna Coric Croatia 6-2, 7-6 (8), 3-6, 7-6 (6) in a hard-fought emotional match.
The 25th-seeded Johnson dropped to his knees and began crying at the end and he was overcome by emotion during an interview with the Tennis Channel right after the match. His father, Steve Johnson Sr., was a tennis coach in California who died about three weeks ago.
"I just miss my dad, you know? I wish he was following along. I know he is, from upstairs," said Johnson, wiping away tears as he choked up. "Just so emotional. It's hard to describe. I just know he was looking down on me on that last point. And gave me the strength to finish it off."
Johnson will next face sixth-seeded Dominic Thiem, who moved into the third round with a 7-5, 6-1, 6-3 win over Simone Bolelli of Italy. The Austrian hit 42 winners and created 30 break-point chances, six of which he converted against the No. 470-ranked Bolelli.
France's Jo-Wilfried Tsonga, the 12th seed, resumed his first-round match against Renzo Olivo of Agentinia. Their match on Tuesday was suspended because of darkness with Tsonga trailing 7-5, 6-4, 6-7 (6), 5-4.
Tsonga managed to save three match points, but the 91st-ranked Olivo converted the next one with a forehand cross-court winner to win 6-4 and advance to the second round.