The Swiss star had won the first set when rain halted the second-round clash a day earlier and, while he did not have it all his own way when play resumed, he was still largely comfortable in advancing.
Federer saved a set point in the second-set tie-break before easing through.
Speaking to the media after the match, Djokovic said, "It felt like my first match on tour".
1 Novak Djokovic made an unsuccessful return to the sport Sunday (Monday AEDT) as he crashed out of the Indian Wells Masters in a Round of 64 match. "Very weird. I mean, I just completely lost rhythm, everything". The win extended his 2018 win streak to 13 matches.
"We wondered post surgery what it was going to look like, how his elbow was going to react to the strain and stress, but it was his heart and head that didn't react the right way in this match".
The 12-time major victor led 5-2 in the opener, but Daniel fought back well to clinch the first set on a tie-break, and although Djokovic pulled level, 61 unforced errors from the five-time champion saw Daniel clinch victory after two-and-a-half hours.
Djokovic took six months off after Wimbledon past year and returned in January's Australian Open where he lost in the fourth round.
Novak Djokovic (SRB) during his second round match against Taro Daniel (not pictured) in the BNP Paribas Open at the Indian Wells Tennis Garden. He lost to Chung Hyeon in the Australian Open fourth round in January before undergoing the surgery.
Federer said he understands well how even a champion like Djokovic could be struggling to find his game so soon after having surgery.
"To me, it's not that surprising", the defending champion said in California.
"When you do come back from injury or when you haven't played in a long time, it just takes extra effort".
Daniel, who is ranked 109th in the world, advanced to the third round where he will face Gael Monfils of France.
Argentina's del Potro, who is fresh off winning the Mexican Open title in Acapulco, hammered five aces and broke de Minaur's serve five times.
He will now play against another American, Jack Sock, who beat Italy's Thomas Fabbiano 6-2, 7-5.
Large-Cap Stocks Mostly Lower on Monday, Tech Stocks Gain
Shares of Micron Technology (MU.O) rose 8.8 percent to $59.37 after analysts at Nomura raised their target for the stock to $100. Johnson Controls was up 1.6 percent after saying it would consider selling a business that makes batteries for vehicles.