The legality of gambling is not related to the payment method. If gambling is illegal in your country, using a debit card for it will be illegal too. If not, you can use any method you want, including debit cards.