Zardari had flown in here earlier in the day along with a huge delegation and joined Ahmadinejad in the groundbreaking ceremony for the Pakistani section of the pipeline in the Iranian city of Chabahar near Pak-Iran border.
The groundbreaking ceremony will mark the start of work on the 781-km Pakistani section of the pipeline to be built at a cost of USD 1.5 billion.
Iran will provide a USD 500 million loan for the project. The pipeline on the Iranian side is almost complete.
"The completion of the pipeline is in the interests of peace, security and progress of the two countries ... It will also consolidate the economic, political and security ties of the two nations," the Presidents of both countries said in a joint statement.
More From This Section
The visit marks Zardari's second to Iran since February 27 and comes despite American warnings.
The US has called on Pakistan to abandon the pipeline project, saying it has offered alternative solutions to the country's energy requirements.
India quit the Iran pipeline project in 2009, citing costs and security issues.
The US has said the project could violate sanctions imposed on Iran over its nuclear activities that Washington suspects are aimed at developing a weapons capability. Iran denies this and says its nuclear programme is for peaceful purposes.
An Iranian-Pakistani consortium will complete the project and Pakistan is expected to start receiving gas after the pipeline is completed in December 2014. Iran will supply 750 million cubic feet of gas a day to Pakistan.