The president's remarks coincided with growing public frustration at his administration for failing to carry out promised reforms.
The anger felt by many Iranians spilled on to the streets in recent weeks and was directed against Khatami and conservative clerics.
Some protestors had called on the president to resign.
Khatami, according to the Iran newspaper, made his comments during a speech he made on Thursday in Karaj, west of Tehran.
First elected in 1997, Khatami has been facing fierce opposition in trying to implement reforms from conservatives who hold key positions in government.
"We are not people's masters, but we are this nation's servants. We will go, if this nation says we do not want you," Khatami was quoted as saying by the newspaper.
"How long do we want to export hatred for each other? How long do the factions want to accuse each other?" Khatami reportedly said.
Khatami has proposed two key reform bills to curb the influence of conservatives over the electoral process and the judiciary.
But the conservative legal watchdog, the Guardian Council, has rejected them.
Khatami said that without the laws, he has as much authority as an ordinary citizen.
Many protestors have been arrested by the authorities during the recent wave of protests.
The international human rights group Amnesty International on Sunday said that up to 4,000 demonstrators had been arrested in Iran since 11 June, and that some 2,000 may remain in detention without charge or trial.
"Many of these detainees appear to have been targeted for demonstrating peacefully," the statement said.
"Amnesty International considers them prisoners of conscience and calls for their immediate and unconditional release," it added.
The group also expressed concern over the arrest of three student activists earlier this week.
Reza Ameri Nassab, Ali Moghtadari and Arash Hashemi of the Office to Consolidate Unity (OCU), a pro-reform student umbrella group, "may have been targeted solely for the peaceful expression of their political views", Amnesty said.
The Iranian government disputes such charges and accuses the detainees of causing public disorder.