SHORT ANSWER
The children of Israel were obligated to carry out God’s will and his law. So when they were not drifting away from God, they did administer justice as directed by God’s perfect law. Many other nations administered penalties that were similar in nature, but they were not ordained by God.
LONG ANSWER
God's Law Clearly Shows Us the Problem of Sin
Why do God’s commandments seem so severe in dealing with sin? Sin is a serious problem for God since it goes against his very nature. It’s because of God’s Holiness and His Justice that the Laws he provided seem so harsh to our sinful natures.
1 Samuel 2:2 (New International Version)
2 "There is no one holy like the LORD; there is no one besides you; there is no Rock like our God.
Zechariah 7:8-12 (New International Version)
8 And the word of the LORD came again to Zechariah: 9 "This is what the LORD Almighty says: 'Administer true justice; show mercy and compassion to one another. 10 Do not oppress the widow or the fatherless, the alien or the poor. In your hearts do not think evil of each other.'
11 "But they refused to pay attention; stubbornly they turned their backs and stopped up their ears. 12 They made their hearts as hard as flint and would not listen to the law or to the words that the LORD Almighty had sent by his Spirit through the earlier prophets. So the LORD Almighty was very angry.
Our Sinful Nature
We are, the opposite of and opposed to God’s Standards; due to our inherited sin nature. His ultimate goal was to establish a specific people that would be set apart from everyone else - an entire nation to serve God. He gives them a law to teach them how to serve him. He provided just penalties for a well defined plan of holiness. God understands how evil the heart of man can be.
Jeremiah 17:9-11 (New International Version)
9 The heart is deceitful above all things and beyond cure. Who can understand it?
10 "I the LORD search the heart and examine the mind, to reward a man according to his conduct, according to what his deeds deserve."
Israel Was To Be a Holy Nation for God
The Israelites were not only to avoid the world’s idolatry, but their whole lives and conduct was to be ruled according to their holy character and high calling. They were to be separate form the world. Israel, as God’s possession was a separated people; they were obligated to deal out the perfect justice that God’s law demanded.
Exodus 19:5-8 (New International Version)
5 Now if you obey me fully and keep my covenant, then out of all nations you will be my treasured possession. Although the whole earth is mine, 6 you will be for me a kingdom of priests and a holy nation.' These are the words you are to speak to the Israelites."
7 So Moses went back and summoned the elders of the people and set before them all the words the LORD had commanded him to speak. 8 The people all responded together, "We will do everything the LORD has said." So Moses brought their answer back to the LORD.
The Law Allows God to Demonstrate His Love
This Law was foundational to understanding the real distance between our sinful condition and God. God provided his Word to help his people understand Him better, the huge problem of sin and the separation it causes from God. Prophecies were established to “set the stage” for Christ’s coming, and the New Law came to complete the process, giving man an avenue to be “reunited” with God in Heaven.
When we see God’s strictness, in either testament, it’s to show us that God means what he says. He is strict. But he’s also merciful. The New Testament tells us that:
Matthew 11:28-30 (New International Version)
28 "Come to me, all you who are weary and burdened, and I will give you rest. 29 Take my yoke upon you and learn from me, for I am gentle and humble in heart, and you will find rest for your souls. 30 For my yoke is easy and my burden is light."
And so does the Old Testament:
Joel 2:12-13 (New International Version)
12 "Even now," declares the LORD,
"return to me with all your heart,
with fasting and weeping and mourning."
13 Rend your heart
and not your garments.
Return to the LORD your God,
for he is gracious and compassionate,
slow to anger and abounding in love,
and he relents from sending calamity.
Jesus Fulfills the Law and Bridges the Holiness Gap
God’s holiness does set high standards with severe consequences for falling short. However, God’s Love, Mercy and Grace are demonstrated through the saving sacrifice of his Son Jesus for our sins. It’s Jesus’ perfection and holiness which fullfills the requirements of the law for us. He is the bridge to spanning the gap between a sinful man and a Holy God.
Romans 5:6-8 (New International Version)
6 You see, at just the right time, when we were still powerless, Christ died for the ungodly. 7 Very rarely will anyone die for a righteous man, though for a good man someone might possibly dare to die. 8 But God demonstrates his own love for us in this: While we were still sinners, Christ died for us.