Q. How did the Israelites have moral standards before the Ten Commandments? How did they know how to behave? Before the Ten Commandments were written down in stone, the Bible tells us that the law was written in the hearts of the people. In addition, it was transmitted orally from father to son.
However, by the time of Moses, after the people had been in slavery under Egypt, and thereby under the influence of the Egyptian pagan religion, their memory had been corrupted somewhat.
That's why Moses wrote the first five books of the Bible, so his people would not be confused. Of course, God ultimately wrote the Ten Commandments so there would never have to be any guessing about what is right and wrong.
To prove this point: Long before Moses wrote the Ten Commandments onto scrolls, the Bible says, "Abraham obeyed my laws and statutes and commandments" Genesis 26:5. And not only did Abraham obey God's law, statutes, and commandments, Joseph knew it was a sin to commit adultery with Potiphar's wife. He said, "How can I sin against God?" How did he know that before the Ten Commandments were written on paper or stone? It had been passed on, so he knew what God's law was.
Originally, it came from Adam orally straight out of the Garden of Eden and became part of the oral tradition. In addition, Adam and Even were created in the image of God, so they knew their Father's character, which is revealed in the Ten Commandments. They passed this knowledge to their offspring, and eventually had to write it down.