Well, that is weird but you can try a few things before having to open up your imac. the first is to do the obvious ones click on the eject button next to your disc or right click and select eject. If not, restart your computer while holding down the "D" key or the trackpad button. The last resort would be to restart your computer while holding command key, this will send you to the screen where you can choose between osx or windows if you are using boot camp, in that screen you should be able to see the cd and then you can try and eject it with the eject button.

If none of these work call apple support and they can tell you what you can do. Is it a normal cd or a weird shape (not round) or one of those small cd's?