Three other Afghans are still being sought, two of whom may have gone back to Afghanistan, Italian media report.
Video clips and photos on the two detainees' mobile phones suggest that they were targeting landmarks in Bari, Rome, Paris and London for attacks.
They included hotels in London's West India Quay and Royal Victoria Dock.
The detained suspects were named as Hakim Nasiri, 23, and Gulistan Ahmadzai, 29.
Several photos released by police show Mr Nasiri posing with a rifle in a shop or warehouse.
The apparent targets they picked in Rome were the Circus Maximus and Colosseum. Police believe the Afghans had formed a jihadist cell linked to so-called Islamic State (IS).
The Bari investigators said one of the suspicious images showed a famous mosque in Mecca tinted blue - a colour associated with Islamic paradise and devotion - and the Eiffel Tower tinted violet - a colour associated with death and struggle.
Another photo showed Hakim Nasiri next to the Mayor of Bari, Antonio Decaro, during a march organised on 10 September 2015 in solidarity with immigrants.
Both suspects held by police have been living in Italy with humanitarian protection status. Mr Nasiri is accused of international terrorism and Mr Ahmadzai of assisting illegal immigration.
In Bari they had filmed the Ipercoop shopping mall, the inside of Bari Palese airport and the port area.
The police swooped after one of them was spotted using his smartphone to photograph the Ipercoop mall.
Police say the suspects' recordings included video tributes to friends and relatives of suspected Islamists held by the US authorities in Guantanamo, Cuba.
Police in the port city of Bari in southern Italy have arrested two Afghan men suspected of plotting jihadist attacks in Italy, France and the UK.