Ali Yasin Ahmed, 31, and Mohamed Yusuf, 33, were sentenced by US District Judge John Gleeson in Brooklyn, New York, in light of their guilty pleas in May to conspire to provide material support to al-Shabaab.
Both men were Somali-born and returned to Somalia from Sweden in 2008 in order to fight.
The Swedes fought against US-funded African Union forces in Somalia, prosecutors said.
Yusuf appeared in an al-Shabaab video to encourage recruits to travel to Somalia and join the group, and also threatened a cartoonist who depicted the Prophet Mohammed -- considered blasphemous to many Muslims.
US officials said the men were arrested by local authorities in East Africa en route to Yemen in August 2012, then handed over to the FBI in November 2012 and flown to New York to be prosecuted.
Al-Shabaab is blacklisted as a foreign terrorist organization in the United States and federal prosecutors have spearheaded efforts to try foreign terror cases in New York courts in recent years.
However in Sweden, membership of a terror organization such as al-Shabaab is not sufficient to be tried as a terrorist on home soil.
Al-Shabaab has claimed responsibility for some of the worst terror attacks in East Africa, including a massacre at a Kenyan university that killed 148 people.
Acting US attorney Kelly Currie said the defendants were "committed supporters" of the Islamist insurgent group, which holds large swathes of territory in the south and centre of Somalia.
Story continues below…
Prosecutors had sought 15 years in prison for the men, who they called "operational members of a terrorist organisation."
But while Judge Gleeson said that was correct, he said he also partly accepted their lawyers' characterisations of the men as freedom fighters who only joined al-Shabaab in order to return to war-torn Somalia to fight against Ethiopia.
The men, who before pleading guilty faced 30 years to life in prison, will be deported after they are released from prison.