If you purchased your copy through the Blizzard store, it should be bound to your account. To get the code, do the following:
On this forum page, click your name (upper right), Account Settings, Games and Subscriptions. Scroll down to “Classic Games”, and you should see this:
“Diablo II” – “License Key” – “Download game client”
“Diablo II Lord of Destruction” – “License Key” – “Download game client”
You’ll need to copy the 26 alpha-numeric code above “License Key” and paste it into the game client installer when prompted.
If you purchased a box copy from a store or online store, it’s probably an old key. You’ll have to redeem the keys for both Diablo 2 and the Lord of Destruction expansion and bind them to your Blizzard account. This can be done by doing the following:
On this forum page, click your name (upper right), Account Settings. Enter the code from the box or jewel case into the “Redeem a Code” field. You would then do the steps mentioned above to get your new 26 alpha-numeric codes to use with the game client installer.
Also it’s worth noting that the new 26 alpha-numeric keys will not work when trying to install using the original installation disks, you must use the downloaded game client installer.