I cannot say for sure... I've never tried. The iMac is a tray load, correct? I assume it could work. My worry is if the tray is too wide for the narrow opening the iMac leaves for the current tray. Maybe you could cut off some of the front faceplate??
Google it to see if it's possible for you to take apart your Mac and do this. There should be plenty of walkthroughs with people trying the exact same thing.
I've never had a problem using PC parts in Macs. Ok, once I tried shoving a 16x DL DVDRW into a very old G3 PowerMac without success.
Good luck.
Bryan
Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.