I don't think its against the law but when Banks issue you withe debit or credit cards, it is part of the terms and conditions that you don't disclose the PIN to anybody.
The shop are not supposed to accept them either, how would the shop assistant know that the owner of the card had given permission? Anyone could say that, you could have spilt from your partner and still have access to their card and PIN or someone could have stolen a purse or wallet with the card and PIN inside (yes, some people do write their number down and keep it with their card).