The worm targeted Microsoft's Windows 2000 operating system which is widely used by many large companies.
About 100 companies, including heavy plant maker Caterpillar, reportedly suffered computer problems as a result of the Zotob worm.
At news firm CNN the worm disrupted the station's live reports. Computers infected by the worm fell into a cycle of constant re-starts.
The authorities caught up with the pair less than a fortnight after the virus struck and many anti-virus experts were surprised that they were based in Morocco. Mr Essabar now faces two years in jail and Mr Bahloul one year.
Mr Essabar is also thought to be behind a series of other viruses that targeted Windows computers.
The pair were thought to have worked closely with an accomplice in Turkey named by the FBI as Atilla Ekici.
Lawyers for the two men said they planned to file an appeal against their sentences.