The two men had faced charges of collecting information to facilitate a terrorist attack.
The head of Kenya's anti-terrorism unit, Munga Nyale, said the men were deported Saturday after a court order.
Sayed Nasrollah Ebrahim and Abdolhosein Gholi Safaee were riding in an Iranian embassy vehicle when they were arrested outside the Israeli embassy late last month.
The prosecution said an agreement to deport them was reached after a meeting between the Director of Public Prosecutions and the Iranian embassy.