Yes, most hotels will charge a fee if you lose your key card. The fee is usually around $25, but it can range from $10 to $50.
The charge is to cover the cost of replacing the key card and to deter guests from losing them. Most hotels require a credit card or deposit to cover the cost of the replacement key card.
If you do lose your key card, be sure to report it to the front desk as soon as possible so they can cancel it and issue you a new one.
What Happens If You Lose Your Hotel Keycard?
If you lose your hotel keycard, the first thing you should do is contact the front desk. They will be able to deactivate your old card and issue you a new one.
Issuing a duplicate key card | Security process and English dialogue
I think that hotels have the right to charge for lost key cards because it is a service that they provide.
If guests lose their key card, then the hotel has to replace it. This costs money and time, so I think it is fair for hotels to charge for this service.