According to media reports, Erdogan and Aliyev traded jokes over a 20-kilogram barbell in the fitness centre.
Azerbaijan and Armenia accused each other on Saturday of attacks in violation of a Russian-brokered truce, as the worst fighting in the South Caucasus since the 1990s continued.
The six-week conflict between Azerbaijan and ethnic Armenian forces over the region and its surrounding areas was brought to a halt by a Russian-brokered ceasefire deal last month.
Fighting has continued overnight between Azerbaijan and its ethnic Armenian mountain enclave of Nagorno-Karabakh, the Azeri defence ministry said on Tuesday, in the fiercest round of the decades-old conflict in more than a quarter of a century.
Azerbaijan and ethnic Armenian forces clashed in several areas of Nagorno-Karabakh on Friday, hours before talks were due to start in Washington to try to end the deadliest fighting in the mountain enclave for over a quarter of a century.
Armenia's defence ministry said Azerbaijani forces were "shelling Armenian villages with mortars and howitzers," while the defence ministry in Baku said clashes were ongoing near the border after "Armenians shelled Azerbaijani villages with large-calibre weapons."
At least 16 military members and several civilians were killed on Sunday in the heaviest clashes between Armenia and Azerbaijan since 2016, reigniting concern about stability in the South Caucasus, a corridor for pipelines carrying oil and gas to world markets.
Azerbaijan and ethnic Armenian forces fought new clashes in and around the Nagorno-Karabakh region on Thursday, before the United States, France and Russia were due to meet in Geneva to try to avert a wider war in the South Caucasus.
With Russia’s mediation, Armenia and Azerbaijan agreed to a cease-fire in Nagorno-Karabakh starting at noon on Saturday following two weeks of heavy fighting that marked the worst outbreak of hostilities in the separatist region in a quarter-century.
Armenia’s foreign ministry said on Friday it was ready to engage with the Organization for Security and Cooperation in Europe (OSCE) to re-establish a ceasefire in Nagorno-Karabakh, where fighting has been raging since Sunday.