I don't see why not. Just needs to be formatted for a Mac. Unfortunately, most Macs these days are very difficult to take apart to replace an internal drive. I use external drives for my iMac. I took apart an old 2008 iMac to install an SSD a few years ago - this was easily doable. In 2012 they made it more difficult to remove the monitor cover in order to access the innards of the iMac. You can still swap out RAM easily but everything else is accessed by removing the monitor. It can still be done but it is less than ideal. One of the reasons I recently converted to PC. Apple makes nice products - sleek, good quality, and user-friendly. Unfortunately, they do not sell an affordable desktop with all of the bells and whistles you will get with a PC for significantly less. The PC I recently built for under $2000 is comparable to the iMac Pro which is over $5000. I won't even get into the Mac Pro. While the iMac Pro is a powerful machine and one slick looking computer, I have concerns about cooling given the tight space they crammed everything in to, and the price tag is just too high for me. The Macbooks, Airs, and Macbook Pros are all great laptops for day to day use, but they are so locked up you can pretty much forget about DIYing any upgrades. MacOs is great software but I have to say Windows 10 isn't too shabby either. I've been converted.
My current products: iPhone XS Max - 256 GB, Late 2012 iMac, 27" with the fastest processor and graphics cards offered on that release, 1st Generation iPad pro (can't remember the release date), Late 2013 Macbook Pro, and a few older iMacs, iPhones, and iPads put to rest in my basement. I now have one custom built PC. I will be able to upgrade this for many years to come and if a hard drive goes it will take me five minutes to swap in a new one. I'm pretty sure I purchased my last iMac in 2012.