You must buy a separate CD/DVD burner, now.
Apple has one that is supposed to work with the iMac, but dosen't list the iMac as one of the Macs it works with.
You can buy a third party, external FireWire 800 CD/DVD and/or Blu-ray burners from OWC (macsales) or from LaCie.
Many, including myself, do not like this option. I can understands perhaps the decline of CDs, but DVDs are still aplenty everywhere. And I still burn personal and family videos to DVD.
Having to add an extra desktop cluttering and wired device goes against the clean minimal footprint of just the iMac and its wireless keyboard and mouse.
Plus, it is now a very significant extra cost.
Plus, I do not use Time Machine any longer. I gotten burned too many times by not being able to retrieve data. So, now, I have gone back to backing up only selected important data like important docs and projects, videos and images to DVD, manually. I use both my older iMac's internal SuperDrive and an external FW SuperDrive.
Apple did what it did. We all have to deal with their decision to do away with the built-in drive.