If you want to play Diablo 4 early before release (beta early access), well, it is only available for players who have pre-ordered the game.
Once you have pre-ordered go to diablo.com/beta and log in or create your Battle.net account if it's not done.
Enter your code in the "Enter your code here" space and select your gaming platform and region from the drop-down menu.
Double check the information you have entered to avoid an access problem, then click on the Activate button.
A page will confirm that your code is validated.
If you're on PC, your game account will immediately qualify for Early Access. For console players, a code will be emailed to the address associated with your Battle.net account shortly before the Early Access Beta begins. This code must then be entered on the store linked to your console in Redeem a code and claim access. All you have to do is download the beta.