For registered users, the IP they registered with is stored as well as the last IP the logged in with and the last IP they posted something with. (These are the fields createip, loginip, writeip in qa_users.)
For all visitors (anonymous/logged-out visitors as well as logged-in users), IPs are stored for various actions including login attempts, registrations, questions and answers posted. This is for the spam options to limit registrations/posts by IP.
Blocked IPs are also stored in the qa_options table. Moderators and Administrators are able to view users' IPs from the front end of the website.