I am one of those who had experienced this kind of problem. My former Time Machine disk used to automatically eject itself when my iMac sleeps, hence upon waking up my iMac. i always get the error message that the disk was not properly ejected.
From what I was able to gather from my experience, until the time that I found a workable solution, I think I can say that the problem is most probably caused by the incompatibility of certain external drives with how the iMac operates when on sleep and upon waking up. Some external drives are just not able to cope with how the iMac tries to remount a connected disk after it wakes up from sleep. There are just some external drives that cannot continue to be mounted after the iMac wakes from sleep. There are just some external drives that are not responsive enough. In other words, the existence of the problem lies with the type of external drive you are using.
My former Time Machine disk, the problematic one, was an Imation M300 Apollo 1 TB external disk. It unmounts everytime my iMac went to sleep, but does not remount after waking up the iMac. The disk will continue to be unmounted until I physically remove its USB connector and replug it in the iMac.
I replaced my former Time Machine disk with my current one, a Transcend Storejet 1 TB. And the problem went away. The Transcend disk continue to be mounted after the iMac is woken up even from the longest of sleep. I have even the energy saving option "put the hard disk to sleep..." checked. The Transcend disk comes with a Y cable, i.e. it has two USB connectors, but I only connect the one for both data and power--and it still remains mounted even after waking the iMac from sleep.
The sad realization, however, is that since there are only some external drives that are not able to work with the iMac, no matter how many those some may seem to be, it will be highly unlikely for Apple to itself fix this kind of a problem.
I, therefore, make the following recommendations:
1. Check first if your problematic disk has a firmware upgrade available. In some cases, the firmware upgrade may be enough to make the disk more responsive to the iMac waking up.
2. If there is no firmware upgrade available, check if your power/data USB cable is properly working.
3. If your power/data USB cable is in order, and the problem still persists, I think it is inevitable that you have to replace the problematic disk with a newer one that could respond well with the iMac's wake/sleep operation. With what disk will you replace your problematic one? I can only recommend from my personal experience the Transcend disk I mentioned earlier. You may also search this forum on other brands of disks that may also work.
Regards.