Principal Faith Rivera of Plum Grove Middle School said nobody was harmed.
"This incident was addressed swiftly thanks to the vigilance of our school community, specifically the immediate response of PGMS building administrators and the Rolling Meadows Police Department," Rivera said in a letter to parents.
It was not clear how the school found out the student had a gun.
The gun was secured and confiscated without incident, according to officials.
It was unclear if the student will face any charges.
No other information regarding the incident was released.
No injures were reported.