More than 450 officers took part in the mass raids targeting 12 locations, mostly in the central city of Goettingen in Lower Saxony state, they said.
Police investigating the fundamentalist militant community had acted on information pointing to "a possibly imminent terrorist attack", said the city's police chief Uwe Luehrig.
Germany plans security overhaul after Berlin attack
They detained the two men, a 27-year-old Algerian and a Nigerian, 23, who had both lived for some time in the city with their families.
Germany was hit by several attacks last year claimed by the Islamic State group - the most deadly of them a December 19 truck rampage though a Berlin Christmas market that claimed 12 lives.
German security services say they consider some 550 known militants as potentially dangerous and capable of carrying out an attack.
German police hunt Tunisian man over Berlin attack
German federal prosecutors, in charge of terrorism cases, have struggled with a flood of investigations against suspects and returned fighters from Syria and Iraq, news magazine Der Spiegel reported last weekend.
Chief prosecutor Peter Frank urgently requested personnel support from Germany's 16 regional state services, complaining in a letter that his national-level service had "reached the limit" of what it could do, the magazine reported.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ