Hi Cindy, first try a different Ethernet cable, despite the fact it works with another computer. Your Windows computer may have a slower port that works with that cable whereas your iMac might need a better cable.
If it still does not work try this:
Go to menu > System Preferences and select Network. On the left column select Ethernet, then click the Advanced button.
Select the Hardware tab and on the dropdown menu next to "Configure" change it to "Manually". Make the rest look like this:
Click OK, then Apply.
If this still results in "cable unplugged" it almost always means your iMac's Ethernet port is NG.