Ibro Cufurovic’s case marks the first conviction of a Bosnian citizen expelled from Syria with U.S. assistance.
Cufurovic, who used the name Abu Kasim Albosni during his five years in Syria, had been held for about two years by a Kurdish militia in Syria before his repatriation in April.
He pleaded guilty to terrorism charges.
Prosecutors said Cufurovic, who is from northwestern Bosnia, left the country in 2014, traveling first to Turkey and then crossing into Syria with the aim of joining IS.
Cufurovic had told the court he fought in Syria in 2014 and 2015 but that he was captured in 2016 while trying to escape to Turkey with his family.
The court said it took his youth and remorse into account in the sentencing.
It rejected video that purportedly showed someone resembling Cufurovic next to dead soldiers, saying the circumstances were unclear.
Hundreds of Bosnian citizens are believed to have left to fight for IS in Syria and Iraq.
A group of 25 former IS fighters, women, and children, some of them orphaned, returned to Bosnia last week.
Authorities have said in the past that 260 Bosnian citizens, including many women and children, remain in makeshift camps in Syria.