Gen Petraeus, who resigned as CIA director in 2012 following an extramarital affair, said the president-elect may succeed on the international stage because he will face less opposition from the American right.
The general, who is among a number of people linked with the position of secretary of state in the incoming administration, indicated he could work with Mr Trump.
He told BBC Radio Four's Today programme: "If you're asked, you've got to serve - put aside any reservations based on campaign rhetoric ... and figure out what's best for the country.
"I've been in a position before where a president has turned to me in the Oval Office in a difficult moment, without any pleasantries, and said, 'I'm asking you as your president and commander in chief to take command of the international security force in Afghanistan'.
"The only response can be, 'Yes, Mr President'.
"It's interesting that those who have been talking to him have said, you know, he's very personable, very hospitable, very gracious guy, full of questions and dialogue."
The general compared Mr Trump to former president Richard Nixon, who thawed relations with China, saying: "Only Nixon could have gone to China. Anyone else would have been criticised from the right.
"I think that the current president would have been criticised from the right had he tried some of the kinds of outreach that, in fact, President-elect Trump may pursue."