Ahmadinejad made no specific reference in his letter to a wave of unrest that swept Iran over the new year but it comes as the country's divided political factions argue over how to respond.
"The immediate holding of free presidential and parliamentary elections -- of course without their being engineered by the Guardian Council and without interference by military or security bodies so that people have a free choice -- is an urgent necessity," he wrote.
The Guardian Council is a powerful vetting body which oversees all elections in Iran and which barred Ahmadinejad, among others, from running for president last May.
The council rejected Ahmadinejad's call for early elections and hit back at his criticism of its supervisory procedures.
"The country has no need for... elections right now because all elections are conducted in a legal and sustainable manner," council spokesman Ali Kadkhodai said.
Parliamentary elections are not due before 2020 and the next presidential election is due in 2021.
Kadkhodai charged that Ahmadinejad had himself sought to get round the rules in the 2009 election by pressing it to publish the results before the legal time-limit.
The former president referred directly in his letter to a speech Khamenei delivered on Sunday in which he said that progress was needed in "the field of justice", acknowledging widespread criticism of the system.
"These clear comments from the leader can of course be understood" as an appeal for "urgent and concrete reforms that meet the demands of the people," he said.
Ahmadinejad called for the dismissal of judiciary chief Ayatollah Sadeq Larijani, a rival hardliner, on the grounds that the "injustices" of the judiciary were "one of the main causes of public discontent."
He also called for the release of all people arrested for criticising the regime and the halting of any proceedings under way.
Ahmadinejad remains popular, particularly among poorer segments of society who recall the large-scale welfare schemes he implemented during his 2005-2013 presidency.
But he has fallen out with the establishment, especially since he ran for president last year against Khamenei's advice.
A number of his senior aides have been arrested on financial and corruption charges, and his protege Hamid Baghaie was sentenced to 15 years in December.
The demonstrations over the new year, during which at least 25 people died, initially focused on economic problems but swiftly escalated into protests against corruption and the regime itself.
During the 2009 protests against Ahmadinejad's re-election, dozens of people were killed as the regime deployed militia to back up police.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)