Hard Drive Stops Showing Up on iMac, still works on MacBook

are you connecting to the iMac or the keyboard?

try different ports… check disk utility