Swiss Attorney General Michael Lauber's ruling went into effect this week, he told public broadcaster RTS late yesterday.
The 30-year-old recent convert to Islam, from the western Swiss canton of Vaud, had travelled to Syria late last year to join an IS training camp.
The man, whose name was not given, told the broadcaster he had been indoctrinated over the Internet.
"I was new to Islam... The videos I saw and the discussions I had online made me feel like I had to go there," he said.
The man, who has been cooperating with authorities and claims to have cut all ties with the jihadist group, was sentenced under a Swiss law against taking part in criminal organisations and under a military law against fighting for a foreign army, according to the report.
Thousands of Western volunteers have joined the IS battle to create an Islamic "caliphate" straddling Syria and Iraq, heightening fears that radicalised and battle-hardened fighters will launch attacks when they return to their home countries.
He stressed though that future cases of returned fighters might result in very different sentences, depending on the details of the case.
"This is a verdict for this case, singular," he told RTS.
