Is this drive the main system disk, or do you have a spare drive in the computer?
If it is the main system drive ( in Windows often labelled as C:, or on a Mac, Macintosh HD ), then you will not be able to eject it, as the whole computer depends on that drive to work. It would be a bit like sitting on a branch of a tree and sawing off the branch you are sitting on (with the saw cut closer to the tree than you)...
If it is a secondary drive (often D: or Y:, or on a Mac a name you have chosen), then it will depend on what you have stored on the drive, and if you are using the contents of the drive within in the system.
If you mean physically removing the drive, then it is usually best to switch the machine off before removing the drive.
If it is an external (as suggested above), then you can just disconnect it, but you risk losing data. That donesn;t happen very often, but has been known. As said, better safe than sorry...
Good luck