What is the meaning of [Hard cases make bad law]

‘Hard’, that is, exceptional, legal cases aren’t suitable as the source of generalised laws.
In British slang a ‘hard case’ is a hardened criminal; a tough pugilist. It is quite reasonable to think that such characters wouldn’t be the ideal choice to draft legislation. Fortunately, they aren’t connected with this saying. ‘Hard cases make bad law’ isn’t so much a universal proverb as a legal adage. It came to light in a comment made by Judge Robert Rolf in the case of Winterbottom v Wright in 1842:

This is one of those unfortunate cases…in which, it is, no doubt, a hardship upon the plaintiff to be without a remedy but by that consideration we ought not to be influenced. Hard cases, it has frequently been observed, are apt to introduce bad law.