Yama and Niyama are popularly interpreted as social and personal codes respectively. Yoga is a holistic system and true to its meaning, it gives inputs to develop ourselves into holistic personalities by introducing us to the foundations of Yoga at the very start.
Most of us associate Yoga with postures alone. But Patanjali in his Yoga Sutras has enlisted the importance to develop qualities such as non-violence, truthfulness, non-stealing, the practice of moderation, and non-greediness ie subtly hinting the need for society as a whole to subscribe to Yama. When observed we would find that when society follows Yama, there is no or less work for security, law enforcement, or judicial agencies, as societal harmony would be the order of the day.
Similarly, as each individual tries to practice cleanliness, contentment, austerity / hard work, self-study, and surrender to the Divine, not just in letter but in spirit, the benefits are not only for the individual but society to get the right role models.
Thus, Patanjali has placed Yama and Niyama as the first two limbs of Yoga, upon which the superstructure of the entire Yoga system is built.
Only a literal, first-level translation of Yama and Niyama is provided above. Serious students of Yoga should take up a deep study of these 10 qualities under proper guidance.