Don't kid yourself about small companies. Unless you're the owner, you're a fungible cog everywhere.
In fairness, anyone can leave at any time. Your employer, regardless of size, has to be prepared for the possibilty that you'll quit for a better job, or for some other reason. It would be inadvisable to get emotionally attached to employees.
The reason you're less likely to get laid off at a small company is that small companies don't have the capital to hire indiscriminately, so they're less likely to have large inefficiencies. The number of employees is already as low as they can get away with, given their current revenue, so only a significant downturn in revenue would justify layoffs.