The optical drives in older aluminum iMacs is, usually, the first hardware component to fail.
Due, basically, to its orientation in the iMac as well as being exposed to excessive internal heat.
You could try cleaning out the drive, by powering down your iMac, unplugging it from wall power, take a credit card wrapped in a microfiber cloth to see if you can get any of the dust and dirt out by pushing the cloth in and out one movement at a time (cleaning the cloth off each time you pull it out of the slot) until no more dirt comes off on the cloth. Plug your iMac back in, boot up your iMac and try the drive, again.
If it has failed, plan B is to purchase an external optical drive.
The Apple made external optical drive only works with newer Macs that no longer have a bulit-in Super Drive.
If you need an optical drive that works with your year and model Mac, look at these.
Not all optical drives are Mac compatible.
Most Mac compatible drives you will only find to be purchased online.
Here are two on Amazon.com that are cheap and Mac compatible
http://www.amazon.com/LG-GP10NB20-Portable-External-Drive/dp/B004K2Z4MS/ref=sr_1 _3?ie=UTF8&qid=1398883289&sr=8-3&keywords=Mac+compatible+external+LG+optical+dr i ve
http://www.amazon.com/LG-Electronics-Portable-External-GP40NB40/dp/B009DS6OFU/re f=sr_1_7?ie=UTF8&qid=1398883289&sr=8-7&keywords=Mac+compatible+external+LG+opti c al+drive
Here's another source for Mac compatible optical drives. These are better quality optical drives.
These are also tray loading drives.
Tray loading optical drives are more reliable, plus they are capable of playing those smaller mini sized discs.
http://eshop.macsales.com/item/OWC/VLU2SD24XS/
http://eshop.macsales.com/item/OWC/MR3F82SD24S/
Good Luck!