Federal MPC prosecutors opened the cases “in 2018 and 2019, and they are ongoing,” the office said in a statement.
One of the two men, aged 24, is a defendant in one of the cases, while the other, aged 18, is standing trial as a minor.
Zurich prosecutors told AFP that the 18-year-old, currently “in custody”, was known to their colleagues in nearby Winterthur who “have been dealing with the radicalisation phenomenon for several years”.
The investigation targeting the younger man before the Vienna attack came under Switzerland's law banning Al-Qaeda and the “Islamic State” (IS) group and related organisations.
The MPC said that the men “knew” the attacker who killed four with an assault rifle in central Vienna on Monday evening, and Swiss authorities are working with their Austrian counterparts to clarify the links between the three.
Winterthur prosecutors in 2017 brought charges against an Ethiopian imam at the local An'Nur mosque after he called for the murder of non-practising Muslims.
And in September, Switzerland's Federal Criminal Court handed a four-year jail sentence to an IS supporter in his 30s dubbed the “emir of Winterthur” by the media for his prominent role in the local Islamist scene.
The MPC has around 70 criminal cases open in relation to terrorism with a jihadist motive, most over propaganda or recruitment for terrorist organisations, terrorist financing and against those who have travelled or sought to travel abroad to fight for jihadist groups.