Most probably your drive has gone bad.
1.If the drive cannot read, it will eject it. This is the standard behaviour.
When you push the media in, if it goes in fully
remains there for a few seconds (during which time the drive tries to read) and then ejects, try a lense cleaner CD and check whether it helps.
2. If the media does not go in fully, there may be some obstruction. Here is a user who found a business card in the slot. "I was having the same issue with my mac. I would put my CD into the drive and it would immediately eject. When i put the cd in i noticed it did not go as deep as it would normally go. So i sort of pushed the cd in with a little force a few times. This time it took a little longer to eject. After about the 3rd try i noticed that when the cd was ejected something was underneath it. It so happened that one of my business cards had been lodged in the drive itself."
If the above does not help, replace the drive or better buy an external USB optical drive.
That's the standard behavior when a drive can't read a disc, and I've seen it happen before (on tray-loading drives)--usually a sign the drive is dead, but it could also be caused by a very dirty lens making the drive unable to read discs.
One question that'll help to figure that out: When you put a disc in, does it pop back out immediately, or does it whirr and chug for a few seconds before spitting it out?
If it hacks it out immediately, sounds like it's either broken or there's something stuck in there. If it waits a while, you could try a lens cleaner and hope it's just dirty, but I wouldn't get my hopes up--it's probably a bad drive. Too bad the slot-loading drives are comparitively expensive to replace.