There are two main factors.
The law
One, as other answers have mentioned, is the law. There are strict regulations that cover everything in aviation, from the way people speak to the training they must have and the specifications and audit trails of almost every piece of equipment they use.
Now it's true that people, especially unscrupulous ones who are keen to save money and might be willing to take a few risks in order to do that, don't always obey they law or follow regulations to the letter. And after all, there are laws against murder with much more significant penalties than for (for example) flying with a bit less fuel than the regulations say you should, and yet people persist in murdering.
The culture
However, the other factor is the culture. A low-cost airline exists in the culture of aviation, not independently, and the culture puts safety first.
Each person working for the airline will have trained and may have worked outside the airline, and will already have acquired attitudes and ways of thinking that prioritise safety and adherence to regulation.
Each person working for the airline will be working with and encountering aviation industry individuals from outside the airline, on a daily basis - if they didn't share similar attitudes and ways of thinking, they'd stand out a mile, and so would a corporate culture that similarly failed to embrace the industry's culture of safety.