A quality management system (short QMS) is a mystical thing.
It's a way for a company to make sure best practices are followed to avoid mistakes and that as a company we **learn from our mistakes and react accordingly. **
You can think of it as a scientific paradigm: As an example, 100 years ago people had the paradigm that the milky way is the only galaxy in the universe. Hubble detected anomalies, brought compelling evidence and now everyone changed their mind and we share the paradigm of being only one among billions of galaxies. No biggie, we can adapt.
A QMS is humanity's and the companies current best guess at how to build the best, useful & safe medical or security related products. Humanity published its collective learnings of how to build such a complex thing as an ISO standard (ISO13485). Companies follow this framework and add lots of details for their specific production process which were discovered by yearlong painstaking errors and improvements.