According to a statement from the school, the victim was attacked in the bathroom of the Commons South residence hall in the 700-block of S. Halsted just after 10 a.m.
Other residents heard the attack and called UIC police, the alert said. The students were able to detain a male suspect until officers arrived, and he is now in police custody.
"Students either heard cries of the victim or commotion and called UIC police. In the time it took them to respond, they managed to detain or at least impede the escape of the suspect," said Bill Burton, UIC spokesperson.
The student is receiving medical care, and campus officials are providing on-site support and counseling to residents, the university said.
The five-story residence hall at 700 S. Halsted Street houses about 190 undergraduate students, according to UIC's website.
Authorities do not yet know how the suspect got into the building, but the alert urges students to make sure security doors are shut and locked at all times.
UIC police are increasing patrols in residence halls because of the incident.
The suspect is a man in his 20s. No charges have been filed.
The Sun-Times Media Wire contributed to this report.