Speaking to BBC Radio 4's Today programme, he said: "The only response can be: 'yes, Mr President'."
Gen Petraeus resigned as CIA director in 2012 following an extramarital affair with his biographer.
It later emerged he had shared classified material with her.
He served as a senior officer under Presidents Bush and Obama. He was the commander of US and Nato forces in Afghanistan, before retiring from the military to take the top position in the Central Intelligence Agency.
Asked if he thought Mr Trump had the correct temperament to be the US President, he said: "It's up to Americans at this point in time not only to hope that that is the case, but if they can, endeavour to help him."
He then indicated he would personally serve under Mr Trump if asked.
"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," he said.
"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,'" he continued.
A number of media outlets have linked the retired general with positions in the new administration.
A report in The Guardian last week linked Gen Petraeus to the race for secretary of state, citing diplomatic sources.
Mr Trump has been putting together his administration made up of friends, family, and former rivals - but several key positions, including secretary of state, remain open.
General Petraeus was indirectly critical of some of Donald Trump's rhetoric during the presidential election campaign, describing the president elect's anti-Muslim comments as toxic.
However, he said he had heard good things from those who have been speaking with Mr Trump since the election result.
"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," he said.
He also suggested that Mr Trump could forge closer ties with Russia, comparing his political position to that of President Nixon's overtures to China in the 1970s.
"Only Nixon could have gone to China. Anyone else would have been criticised from the right," he said.
"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."
But he warned that any such outreach should be attempted "with your eyes wide open".

Lancashire County Council has earmarked land on the former Glenburn Sports College and Skelmersdale College.
The sports college closed in August, while Skelmersdale College's Westbank campus, owned by Newcastle College, is also unused.
The decision follows a comparative study by Network Rail of both sites and one near the Concourse shopping centre.
Skelmersdale's original railway station closed to passengers in 1956.
The council - which owns Glenburn Sports College - said Skelmersdale could get two direct trains to Liverpool per hour under the plans it has made in partnership with Merseytravel and West Lancashire Borough Council.
County councillor John Fillis, cabinet member for highways and transport, said it was an "exciting step forward".
He said the preferred location was big enough to allow for the possibility of future expansion.
He added: "It has good highway access and good connectivity to the town and the surrounding area."
The authority confirmed it will now start the process of acquiring the relevant land.
Skelmersdale was designated a new town on 9 October 1961..
It is one of the largest towns in the north west of England not to have its own railway station.
General David Petraeus, one of the United States' most prominent military officers, has indicated he would be willing to serve in President-elect Donald Trump's administration if asked.
[NEXT_CONCEPT]
The preferred location for a town's first railway station in 50 years has been revealed.