It sounds like you're not hearing audio from you headphones when connected to your iMac. You may want to check the output settings in System Preferences. You can find the steps to do this in this article:
If the setting is correct there, and you are still not getting audio from the headphones, I recommend resetting the NVRAM / PRAM:
Thank you for using Apple Support Communities.