The TV channel said one of those sentenced had set up a terrorist organization while in prison and others had committed takfir - labeling followers as non-believers - against the Saudi government, clerics and security forces.
In 2017, the Sunni Muslim-ruled kingdom launched a crackdown on dissent, arresting scores of clerics, intellectuals and activists. Some of them have been put on trial for terrorism-related charges.
In April, Saudi Arabia beheaded 37 men for terrorism crimes. The U.N. human rights chief said most of them were Shi'ites who may not have had fair trials and at least three were minors when sentenced.
Riyadh has come under mounting international scrutiny over its human rights record since the murder of journalist Jamal Khashoggi in October 2018 and the detention of women's rights activists who are still on trial.
Ekhbariya did not give the nationalities or names of those convicted out of the 41 people in total on trial, nor did the TV channel provide details about when they were arrested.
It said the specialist criminal court in Riyadh, which was set up to try terrorism cases, sentenced one man to 25 years, another to 20 years and a third to 15 years. The rest received sentences ranging from 2-1/2 years to 12-1/2 years.
The convictions can be appealed.