God’s laws have been around long before the Ten Commandments were given at Mount Sinai.
It was Satan who decided to no longer follow them and lead a third of the angels in rebellion against them and God’s government.
The Israelites, when coming out of Egypt, were told (reminded as they most likely had forgotten) to keep the Sabbath. This is in Exodus 16, before the Ten Commandments were given in Exodus 20:
Six days ye shall gather it; but on the seventh day, which is the sabbath, in it there shall be none.
Exodus 16:26
And long before this, Abraham kept all of God’s laws and statutes, well before there ever was an Israelite:
Because that Abraham obeyed my voice, and kept my charge, my commandments, my statutes, and my laws.
Genesis 26:5