Try shutting down the iMac and disconnecting all USB devices, including any hub. Start up with only standard USB mouse/keyboard connected (if normally used). Do this to reset the shuffle
http://support.apple.com/kb/HT1655
Run iTunes. Connect shuffle to a direct USB port on iMac. This is checking if there may be some interference with other USB devices.
If that does not help, since this is a 2nd gen shuffle (also for 1st gen), there is a special reset utility.
http://support.apple.com/kb/ht1238
You can download it to see if it will recognize the shuffle, and "reset" it (similar result to doing a Restore in iTunes).
If that does not help (the utility does not see it either), there may be a hardware problem with the connection. The USB port (on iMac) is probably fine (you can connect something else to the same port to confirm). The cable with dock could be the problem. And the connection on the shuffle (the multi-purpose headphones jack) could be the problem.