Mr Ban said he had received assurances that Iran would play a positive role in securing a transitional government.
But Syria’s main opposition group said it would withdraw from the talks unless Mr Ban retracted the offer to Iran.
And the US said the offer must be conditioned on Iran’s support for the 2012 deal on Syria’s transition.
The preliminary talks will open in Montreux on Wednesday and then continue in Geneva two days later.
Syria’s government earlier agreed to attend the meeting.
The three-year conflict in Syria has claimed the lives of more than 100,000 people.
An estimated two million people have fled the country and some 6.5 million have been internally displaced.
On Sunday, UN Secretary General Ban said that Iran’s Foreign Minister Mohammad Javad Zarif had pledged that Tehran would play “a positive and constructive” role in Montreux.
“As I have said repeatedly, I believe strongly that Iran needs to be part of the solution to the Syrian crisis,” he added.
And Mr Ban stressed: “Let me be clear – Montreux is not a venue for negotiations. The Syrian parties themselves will begin that process in Geneva on 24 January.”
Shortly afterwards, Iran said it accepted the invitation. Tehran had earlier insisted it wanted to take part but without preconditions.
There had been a dispute over whether Iran, a crucial ally of Syrian President Bashar al-Assad, should be taking part in the talks.
The UN and Russia had advocated a role for Tehran, but the US had reservations because of its failure to endorse the 2012 Geneva communique, detailing Syria’s political transition process.
Washington is also concerned about Iran’s deployment of military personnel in Syria, and its support of Lebanon’s Hezbollah movement, which had sent fighters to bolster Mr Assad’s forces.
Responding to Mr Ban’s invitation, Syria’s main political opposition group, the Syrian National Coalition, threatened to withdraw from the Geneva talks.
In a tweet, SNC spokesman Louay Safi wrote: “The Syrian Coalition announces that they will withdraw their attendance in G2 unless Ban Ki-moon retracts Iran’s invitation.”
In a statement, US State Department spokeswoman Jen Psaki said Washington viewed Mr Ban’s invitation “as conditioned on Iran’s explicit and public support for the full implementation of the Geneva communique including the establishment of a transitional governing body by mutual consent with full executive authorities.
“This is something Iran has never done publicly and something we have long made clear is required,” Ms Psaki added.
“We also remain deeply concerned about Iran’s contributions to the Assad regime’s brutal campaign against its own people, which has contributed to the growth of extremism and instability in the region.
“If Iran does not fully and publicly accept the Geneva communiqué, the invitation must be rescinded.”
The SNC had only agreed to attend the talks two days ago.
The coalition’s leader, Ahmad Jarba, said on Saturday that the SNC was going to the talks “without any bargain regarding the principles of the revolution and we will not be cheated by Assad’s regime”.
“The negotiating table for us is a track toward achieving the demands of the revolution – at the top of them, removing the butcher from power,” he added.
US Secretary of State John Kerry welcomed the decision.
“This is a courageous vote in the interests of all the Syrian people who have suffered so horribly under the brutality of the Assad regime and a civil war without end,” he said in a statement.
UK Foreign Secretary William Hague also praised the SNC’s “difficult decision”, adding: “As I have said many times, any mutually agreed settlement means that Assad can play no role in Syria’s future.”
Syrian opposition figures had earlier expressed reluctance to go to Switzerland unless President Assad was excluded from any future transitional government.
Damascus says there cannot be any pre-conditions for the talks.