The servicemen are not accused of aiding the 21-year old Saudi Air Force lieutenant, the BBC reported on Monday.
But US Attorney General William Barr said the cadets were found to have had jihadist material and indecent images of children in their possession.
Three sailors were killed and eight wounded in the December 6 attack. Training for Saudi servicemen was put on hold in the US after the attack.
Barr told a news conference on Monday that the shooting at Naval Air Station Pensacola had been an "act of terrorism".
He said he had asked Apple to unlock two iPhones that belonged to the gunman, who was killed by police in the attack. The gunman fired a bullet into one phone in an effort to destroy it, Barr said, but FBI investigators were able to restore the device.
"We have asked Apple for their help in unlocking the shooter's iPhones," Barr said." So far Apple has not given us any substantive assistance."
Apple had given the FBI iCloud data from the attacker's online account, the New York Times reported, but refused to unlock the phone, saying it would undermine their own encryption software.
The tech firm has clashed previously with the FBI over requests to unlock iPhones belonging to terror suspects. A similar 2016 clash was resolved when the FBI found a way to unlock a phone belonging to a mass shooter in California without help from Apple.
Barr said that initial reports that other Saudi cadets had filmed the attack as it unfolded were inaccurate. The gunman had arrived at the scene of the shooting alone, he said.
The attorney general said 17 of the expelled cadets were found to have possessed online terrorist material. Fifteen, including some of the 17 who possessed online terrorist material, had indecent images of children, he added.
"While one of individuals had a significant number of images, all the rest had one of two images, in most cases posted in a chat room by some other person or received over social media," said Barr.
He said the 21 cadets were being disenrolled and returned home on Monday. The Saudi cadets, he said, had fully co-operated with FBI investigation.
Barr also said the Kingdom of Saudi Arabia had given "complete and total" support to the inquiry. Saudi officials had determined the cadets' conduct was "unbecoming an officer in the Saudi Royal Air Force and Royal Navy", said the attorney general.
( With inputs from IANS )