I have the same popping sound occur on my MacBook Pro whenever an electrical device in the room, such as the small refrigerator or ceiling fan, turns off. In my case, it happens due to old wiring in the house. How's your wiring?
If you think wiring could be the cause, try using the iMac in a different room or on a different circuit to see if the popping still occurs. GSM cell phones can cause audio problems as well, but not usually pops.
Good luck. Hope your iMac is not to blame.