If you did not have a written employment agreement or contract saying that you were a just cause employee, then, yes, they could do that. That is because you would be an at-will employee.
This means that you could quit your job at any time and there's nothing your employer could do about it.
That also means the reverse is true: your employer could terminate you at any time and for any reason (so long as it wasn't because of your race, age, gender, disability, national origin, religion, military veteran status, etc.) and there isn't a darn thing you can do about it.
An employer may dismiss an employee at any time for any reason; a good reason, a bad reason, or for no reason at all.
Now, does that seem to be unfair or unjust? You bet it does. However, it is not illegal.
That is the very nature of "at-will" employment. You serve "at the will" (or whim?) of the employer.
Of course different people can disagree as to whether or not the punishment fit the "allaged" wrong in your situation. But, when you're an at-will employee, your employer doesn't have to even go there. They could have fired you because they didn't like which hand you used to lift your coffee cup. They could have fired you because they didn't like the shade of green socks you wore to work. They could do this when you are an "at-will" employee.
Good luck and best wishes for better days ahead. I hope that you find this information to be helpful in better understanding where you may stand and why. I also hope that you find this answer to be ACCEPTable!