The visit to Iran marked the first by a Japanese prime minister since a 1979 revolution installed an Islamic government and is viewed as a bid to increase Tokyo’s influence on the international stage.
"There is possibility of an accidental conflict and a military conflict should be prevented at all costs," Abe told a joint news conference in Tehran with Iran's President Hassan Rouhani.
The Japanese prime minister, who is due to meet Iran's Supreme Leader Ayatollah Ali Khamenei on Thursday, also urged Tehran to play "a constructive role in building solid peace and stability in the Middle East."
Rouhani for his part reiterated a warning that Iran would offer a "crushing" response if attacked by the US. He also claimed that Japan wanted to again buy Iranian crude oil, though Abe did not acknowledge expressing that in their talks, France24 reports.
"Whenever the economic war stops, we will see a very positive development in the region and the world," Rouhani said.