Mavericks downgrade to Mountain Lion - alert cannot be installed on this computer
Verify that your iMac can run the older version of Mac OS X. You can see what versions can be run by searching for your specific model of iMac at EveryMac

Sometimes I have seen that even if a Mac was shipped with an older version of Mac OS it is difficult to downgrade due to firmware upgrades that make the system incompatible with older releases. I haven't personally experienced this sort of issue in maybe 10 years.