A rifle, ammunition "and documents inciting towards jihad" were seized during the operation on Thursday, it said in a statement.
An initial investigation pointed towards the men having ties with IS in Syria and Iraq, "recruiting and sending Moroccan volunteers" there.
A study by the US-based Soufan Group said last December that at least 1,200 Moroccans had travelled to fight alongside IS in Iraq and Syria in the previous 18 months.
In 2011, a cafe bombing killed 17 people, mostly foreign tourists, in the central city of Marrakesh.
It was the deadliest attack in Morocco since Casablanca blasts in 2003 that killed 45 people, including 12 suicide bombers, and were claimed by Islamic militants.