"Africa's democratic progress is also at risk when leaders refuse to step aside when their terms end," Obama said in a speech at the AU's headquarters in the Ethiopian capital.
"No one should be president for life," Obama said, adding that he himself was looking forward to handing over to his successor.
"I have to be honest with you: I just don't understand this. Under our constitution, I cannot run again. There's still so much I want to get done to keep America moving forward. But the law is the law and no one is above it, not even presidents," he said.
Obama singled out Burundi's President Pierre Nkurunziza -- whose re-election to a third term provoked weeks of unrest in the small central African nation -- as an example of the dangers of trying to stay put.
Also Read
"When a leader tries to change the rules in the middle of the game just to stay in office, it risks instability and strife, as we've seen in Burundi."
He said clinging to power was "often just a first step down a perilous path."