Avid macOS users can now install the licensed version of the software that shipped with their computer on a new hard drive without USB install key or install CD. Instead of the installation media, you could just use a Wi-Fi connection for booting through internet recovery.
Here's how you do it:
Steps to install macOS on new hard drive without USB key or install CD
Step 1: After you have physically installed your new hard drive into the available slot in your desktop's hard drive bay, just power on your Mac. Then quickly press and hold Command, Option and R keys together, until the device boots into Internet Recovery.
Step 2: Now select your Wi-Fi network from the available list of networks and enter the authorisation password when prompted.
Step 3: Select Disk Utility via Mac OS X Utilities screen.
Step 4: Now choose your new hard drive from the list of mounted devices in the left-hand column.
Step 5: Select how many partitions you want on the device from the partition layout dropdown menu. Then name the partition and make sure the selected format is Mac OS Extended (Journaled). For the purpose of this tutorial, we create a single partition with the name Macintosh HD.
Step 6: Now click the Options button and verify GUID Partition Table is selected and then hit the OK button.
Step 7: Hit the Apply button and then click the Partition button to confirm the action and proceed with partitioning process.
Step 8: Choose Quit Disk Utility using the relevant option from the Disk Utility menu at the top left corner of the window.
Step 9: Now select Reinstall Mac OS X option from the Mac OS X Utilities menu.
Step 10: Hit Continue to run the installation wizard. You will receive a verification notice for checking your eligibility criteria, before restoring your computer. Just click Continue to proceed.
Step 11: Click on Agree to accept the software license agreement for installing Mac OS X.
Step 12: Choose your new hard drive and hit Install.
Step 13: Original Mac OS X that shipped with your computer will now be downloaded and installed. Wait until the installation completes and then reboot the computer when prompted.
[Source: iClarified]