Why or how can God say that Abraham kept his commandments?

Question:
In Genesis 26:5, God is talking to Isaac, and one of the things He mentions is that his father Abraham obeyed His voice, kept His charge, commandments, statutes, and laws. Now some of you have probably guessed my question already. The law and all of its commandments weren’t given until the time of Moses and the Israelites. Why or how then does (or can) God say that Abraham kept these things?

Answer:
In Genesis 26:5 the Lord says: “Abraham obeyed My voice, and kept My charge, My commandments, My statutes, and My laws.”

It is certainly true that the Mosaic Law was not in existence during Abraham’s life (it came 430 years after God gave the promises to Abraham—see Galatians 3:16, 17), but this does not negate the truth of Genesis 26:5. Earlier in Genesis we read, “For I know him [Abraham], that he will command his children and his household after him, and THEY SHALL KEEP THE WAY OF THE LORD, TO DO JUSTICE AND JUDGMENT; that the Lord may bring upon Abraham that which He hath spoken of him” (Genesis 18:19).
We can infer from these verses that although Abraham had not been given “the Law,” he had been given certain commandments in order that he might “keep the way of the Lord.” One of the commandments given to Abraham is found in Genesis 17:10, 11, “This is my covenant, WHICH YE SHALL KEEP, between me and you and thy seed after thee; Every man child among you shall be circumcised. And ye shall circumcise the flesh of your foreskin; and it shall be a token of the covenant betwixt me and you.” We know that Abraham “obeyed his voice” and had all males in his household circumcised.
We read of another command that God gave to Abraham in Genesis 22:2, “And He [God] said, Take now thy son, thine only son Isaac, whom thou lovest, and get thee into the land of Moriah; and offer him there for a burnt offering upon one of the mountains which I will tell thee of.” This was no doubt the hardest command that Abraham had ever received, and yet we read of his faithful response in the next verse, “And Abraham rose up early in the morning, and saddled his ass, and took two of his young men with him, and Isaac his son, and clave the wood for the burnt offering, and rose up, and went unto the place of which God had told him.”
We could cite other examples of “commandments” that were given unto Abraham, but these two will suffice to show us that there were indeed commands given to Abraham. It is also very possible that he was given “charges, commandments, statutes, and laws” of which Scripture is silent. The point we want to make is that they were not the same laws which the children of Israel received from God through Moses.One more point we should make is that although Abraham was given certain commandments and laws, he was not UNDER THE PRINCIPLE OF LAW, as the children of Israel were when they received the Ten Commandments at Mount Sinai. Abraham was actually under grace. This is easily seen in the epistle of Galatians, where God contrasts “Law” and “Grace” and he uses Abraham as an example (see 3:1-18) of one who was under grace, and not under law. We can say the same of us today. Even though we have been given certain commandments, we are not “under law,” but “under grace” (Romans 6:14).