Try the following on your iMac, in order, until (hopefully) resolved:
1a. Delete Preferred Network(s)
System Preferences > Network > Wi-Fi > Advanced > Wi-Fi tab
Under "Preferred Networks," delete the network(s) you regularly use from the list.
1b. Delete AirPort Keychain Entries
Launch the "Keychain Access" application located in Applications/Utilities.
In the windows on the left side: Select login for Keychains and "All Items" for Category.
Click on the "Kind" filter at the top, and look for any "AirPort network password" entries...and delete them.
1c. Add Preferred Network(s)
System Preferences > Network > Wi-Fi > Advanced > Wi-Fi tab
Add the preferred network(s) using the "+" button.
Restart or log out then back in.
2. Move System Configuration Files
(Note: You will have to reestablish your network connections settings.)
Go to Macintosh HD/Library/Preferences
Move the SystemConfiguration folder to the desktop.
Restart your Mac. (Note: OS X will rebuild the folder & files that are now sitting on your desktop into the Library > Preferences location. If this doesn't resolve the issue, you can move the folder back to it's original location.)