Two hours is plenty of time to clear immigration at Chicago. Get to the immigration line quickly once you get off the plane. But DO NOT TELL the immigration officer that you have a flight to catch or tell him to hurry. Be very polite and have your documents in order.
If you miss the connecting flight because of immigration clearance delay, the airline will put you on the next flight.