The specific situation I was referring to was when I was working as a contractor on a rolling contract so I had very little legal protections, nor was I entitled to severance. I had been contracting there for years so this came completely out of the blue.
I've had a similar things happen a couple of other times though, once during a mass layoff of the engineering department and the another time at a startup that ran out of money after a failed funding round. Both of those times I was kind of aware of the situation about a month ahead of time and was in a better financial situation so they went much smoother although it was still a very stressful few weeks.
I've never been fired, but I've seen people get fired for fairly trivial reasons. Basically, "we don't really like him and this is a good excuse to get rid of him".
How do you know that? OP doesn't say whether or not other people were let go at the same time also. It could be either.