During the visit, Iranian and Cuban officials signed agreements for collaboration in the health, education and science sectors, as well as a memorandum of understanding on banking.
Rouhani, who stopped off in the Communist-ruled island on his way to the United Nations General Assembly in New York, also met with Raul's predecessor and elder brother, Fidel Castro.
They discussed the importance of food production in a world threatened by climate change, the incessant growth of the global population, and the dangers to the preservation of peace, the Communist Party newspaper Granma wrote.
Iran and Cuba have long been friendly, united partly by their respective stand-offs with the United States, although both have seen relations with Washington thaw in recent years.
Rouhani's visit comes a month after his Foreign Minister Mohammad Javad Zarif kicked off a tour of Latin America with a trip to Havana, promising to open a new chapter in bilateral relations.