The imams are accused of reporting on Turkish followers of US-based Islamic preacher Fethullah Gulen, who Erdogan blames for last July's failed coup attempt against him.
The four imams allegedly passed on information through the Turkish consulate in the western city of Cologne to the Turkish Religious Affairs Directorate, known as Diyanet, prosecutors said.
“The purpose of today's searches is to gather further evidence on the alleged activities of the accused,” prosecutors said after the raids in the western states of North Rhine-Westphalia and Rhineland-Palatinate.
News site Spiegel online reported the imams belong to Ditib, an organisation controlled by Ankara that manages some 900 mosques or religious communities in Germany.
The Erdogan government has cracked down hard on followers of Gulen, who denies he was behind the attempted putsch.
More than 41,000 people have been arrested over their suspected links to Gulen's movement, and 100,000 fired or suspended. Many of them are teachers, police, magistrates and journalists
The government says the purges are necessary to clean the state of the “virus” of Gulen's movement, which encourages its members to work in public services.
Human rights activists have fiercely criticized the magnitude of the crackdown, saying it has gone well beyond alleged coup plotters.
In Germany, thousands of Turkish citizens have applied for asylum since, among them reportedly dozens of Turkish soldiers stationed at NATO bases.
Germany is home to some three million people of Turkish origin, the biggest population of Turks in the world outside Turkey.
Chancellor Angela Merkel's government has repeatedly criticized the scale of the crackdown and urged Erdogan to safeguard civil liberties.
Erdogan, meanwhile, is exasperated that Germany has failed to extradite hundreds of suspects linked to the coup, as well as the outlawed Kurdistan Workers' Party (PKK) and the ultra-left.
Merkel also wants Turkey to keep implementing a deal that has reduced immigrant flows to Europe, despite threats by Erdogan to walk away from it due to a failure to fulfil a pledge to grant Turks visa-free travel.
Erdogan's government meanwhile has also irritated Berlin by campaigning for Turkish votes in Germany.
Next Saturday, Prime Minister Binali Yildirim plans to speak in Oberhausen, in North Rhine-Westphalia, to promote a “yes” vote in an April 16th referendum that would expand Erdogan's powers by creating an executive presidency.
Germany's integration commissioner, Aydan Ozoguz, told Bild daily that with such events, Ankara was “deepening divisions” among Turks living in Germany.