The two teens, aged 15 and 17, were arrested on Thursday, state prosecutors in Karlsruhe said.
The pair are suspected of trying to procure firearms for a possible attack on an unidentified public facility in the Aschaffenburg area, south east of Frankfurt, the prosecutors said.
Police seized Islamic extremist propaganda, flags of the Islamic State group and mobile phones. They found no firearms.
Prosecutors said there was no evidence the suspects would have been able to carry out their plan, but they were arrested on suspicion of conspiring to commit an attack.