In Exodus 21:2 we read the instructions that God gave the Israelites concerning the treatment of slaves. Although the Jews were involved in the universal practice of slavery at that time, the treatment of their slaves was governed by God's restrictions and laws – a code that usually encouraged fair treatment and eventual liberation.
The point to note here is that every area of their lives was governed by God's direction, even the unsavory issue of slavery. Yes, they kept slaves but unlike the nations around them, they treated them fairly and even allowed them their freedom.
The forty years in the desert served as a period of transformation for the Israelites where they learned and adopted God's ways for worshipping, treating each other, and living their lives in a faithful and God-like manner.
We read the Old Testament and much of what we see are rules but the rules were there to distinguish God's people from those who were not. Obeying the rules didn't make them better (they were never meant to do that, Rom. 5:20); they did, however, make them different.
It is the same today. The New Testament provides teaching and direction about every aspect of our lives and as Christians we try to pattern ourselves according to the form given to us there. But the purpose of these is the same as the instruction in the Old Testament – to identify us as God's people, not to make us perfect.
Let's remember that being baptized, loving our neighbor, regular church attendance, etc. can't enable us to become sinless, but they will bear witness to the fact that we are God's people in the modern age.