The official SPA news agency did not specify which foreign conflicts they were found guilty of participating in but in recent months Saudi officials have expressed growing concern about Saudi volunteers fighting in the war in Syria, and Saudis have also been active in Iraq.
The 18 men were found guilty of "adopting a Takfiri (Sunni extremist) ideology, and breaking away from the rule of the ruler by travelling to the lands of sedition to take part in fighting," the news agency said.
Some were found guilty of possessing weapons and plotting to kill a Saudi policeman.
Other charges included "collecting funds to support fighters in Iraq" and posting recruitment videos on the Internet.
Also Read
The statement did not detail the nationalities of the foreigners among those convicted.
It said 13 of the 18 had lodged appeals.
Saudi officials have issued increasingly stern warnings against volunteers from the conservative Sunni Muslim kingdom heading off to fight alongside the mainly Sunni rebels trying to oust Syrian President Bashar al-Assad.
The involvement of Saudis in jihadist groups active in Iraq and Syria has stoked concerns in Riyadh of a resurgence of the deadly Al-Qaeda attacks that rocked the kingdom between 2003 and 2006.