No, it is not safe but is common practice because most people have no other way to pay the deposit. The hotel wants to make sure it gets paid for at least the first night which is why they are asking for a deposit. Otherwise, some hotels overbook instead, just like airlines, expecting a certain number of cancellations. That they want a deposit is good news because your room is usually guarantied.
Hotels generally ask for a credit-card number and expiration which they want to use in case you do not show up at the date of your reservation. There is a time cut-off when they usually do this (Say 8 PM for example). So, if your flight is late, you want to let them know, to avoid the case where they charge your card and then book the room to someone else.
The reason this is not secure is that hotel usually write your information down somewhere, sometimes on paper in their system and both can leak your information. It may be used fraudulently just like any of time your credit-card information is leaked. There is some amount of protection from your card company but that varies between cards and jurisdiction.