Can a former employer to give a bad reference?
Yes they can--if it's truthful. There is no law against saying bad or negative things, for a job reference or otherwise, if they are the truth. Or, for that matter, if it's purely a personal opinion: a former employer can say, "I think Bob is the worst worker I ever had," since that's an opinion.
What is illegal is making false statements of fact. If, in giving a reference, someone says something that is negative and which purports to be a fact--for example, a statement that someone stole when they didn't, were excessively absent when they were not, etc.--that might be defamation.