The law makes it debut only after Israel's rescue from the captivity of Egypt. Specifically, the law begins to pile up on the nearly salvaged nation after each transgression of the law only recently given. God rescues Israel, gathers them at the foot of Mt. Sinai, calls Moses up the mountain to receive the Ten Commandments, and Israel throws a party and makes an idol before Moses can get back. You've all seen the movie, probably, of Charlton "Moses" Heston breaking the commandments and having to go back for more, right?
The Apostle Paul tells us why God gave the Law to Israel. He writes:
This is what I mean: the law, which came 430 years afterward, does not annul a covenant previously ratified by God, so as to make the promise void. For if the inheritance comes by the law, it no longer comes by promise; but God gave it to Abraham by a promise. Why then the law? It was added because of transgressions, until the offspring should come to whom the promise had been made" (Galatians 3:17-21).
Paul says that the law came 430 years after the promise was made to Abraham that all nations would be blessed through his "seed" or his "offspring." Paul interprets this Messianically, meaning that the "seed" through whom the world would be blessed is the Messiah, whom Paul professed to be Jesus of Nazareth. Paul's explanation of the law is rather simple. Israel was so obstinate in the wilderness and so unfaithful to God, that God had to issue a sort of "divine martial law" to keep Israel in check until the Messiah came to redeem them and establish a New Covenant with them.
Martial law is established in a country that has become chaotic, often during a rebellion or riotous protests against a government. This is what we see in the Old Testament. The sinful people of God rebelled against him time after time in their wilderness travel. So God clamped down on them through the enforcement of divine martial law. He told them what to eat, how to shave, what to wear, when to take a holiday, when to work, and when not to work. All of this so that their rebellion would not utterly destroy them before the time of redemption.
Since Jesus is the promised Messiah, the offspring of Abraham, Isaac, Jacob, Judah, and David, and since he has instituted the New Covenant by his own death and resurrection, martial law has been lifted. That isn't to say that the divine martial law was wicked. It all, every rule, jot, and tittle, flowed from the two commandments of loving God with all one's heart, mind, soul, and strength, and loving one's neighbor as oneself.
So it isn't moral relativism to insist in one epoch the abstaining from shellfish and then to eat it in another. It is simply a different circumstance. It is a good thing for a government to institute curfews during a period of martial law so that order can be maintained. This is the purpose that the law serves: to restrain wickedness. It serves, spiritually speaking, to keep the spiritual looters and rioters from harming the people of God.