Here are some steps you can take:
1. Check Hardware Connections and ensure the hard drive is properly connected to your MacBook Pro. Sometimes, reseating the hard drive or trying a different cable can resolve connection issues.
2. Boot your MacBook Pro into recovery mode (hold down Command + R during startup) and use Disk Utility to check the health of your hard drive. Disk Utility might be able to repair some errors.
3. If your hard drive is accessible through recovery mode, then it's better to back up any important data before proceeding with further troubleshooting steps.
4. If your hard drive continues to be inaccessible, you might need to consult a professional data recovery service to retrieve your data. Consider iBoysoft Data Recovery for Mac, it covers data loss scenarios due to sudden power outages, improper ejection, human error, and the situation the questioner met.
If the hard drive appears healthy and you have backed up your data, you can try reinstalling macOS from the recovery mode or using the installer to see if it recognizes your hard drive.
5. If these steps do not resolve the issue, it's more likely that your hard drive has corrupted and needs to be replaced. In that case, you can consider getting a new hard drive and reinstalling macOS or restoring from a backup once the new drive is in place.
You can also refer to Fix Hard Drive Not Showing up or Work | Guide in 2024