The Law was given to reveal sin and to show man that he is a guilty sinner before God and to bring men to Jesus Christ.
Romans 3:19 Now we know that what things soever the law saith, it saith to them who are under the law: that every mouth may be stopped, and all the world may become guilty before God.
Romans 3:20 Therefore by the deeds of the law there shall no flesh be justified in his sight: for by the law is the knowledge of sin.
Romans 3:28 Therefore we conclude that a man is justified by faith without the deeds of the law.
Romans 7:12 Wherefore the law is holy, and the commandment holy, and just, and good.
Romans 7:13 Was then that which is good made death unto me? God forbid. But sin, that it might appear sin, working death in me by that which is good; that sin by the commandment might become exceeding sinful.
1 Timothy 1:9 Knowing this, that the law is not made for a righteous man, but for the lawless and disobedient, for the ungodly and for sinners, for unholy and profane, for murderers of fathers and murderers of mothers, for manslayers,
1 Timothy 1:10 For whoremongers, for them that defile themselves with mankind, for menstealers, for liars, for perjured persons, and if there be any other thing that is contrary to sound doctrine;
Galatians 2:16 Knowing that a man is not justified by the works of the law, but by the faith of Jesus Christ, even we have believed in Jesus Christ, that we might be justified by the faith of Christ, and not by the works of the law: for by the works of the law shall no flesh be justified.
Galatians 3:24 Wherefore the law was our schoolmaster to bring us unto Christ, that we might be justified by faith.
Galatians 3:25 But after that faith is come, we are no longer under a schoolmaster.
People in O.T. times did not understand completely about how Jesus Christ would come to earth and die for their sins, but when they believed in the things God told them, they were saved by their faith in God's Word.
Romans 3:25 Whom God hath set forth to be a propitiation through faith in his blood, to declare his righteousness for the remission of sins that are past, through the forbearance of God;
From my post (#981) in this thread:
The moral absolutes have not changed, but the way of God's administering those absolutes has changed. For example, idolatry and adultery have been just as wrong in God's sight since the time of the cross as they were when the Mosaic Law was in effect, but since the cross, God has not required the death penalty for those sins (1 Corinthians 6:9-11) as He did when the Mosaic Law was in effect (Exodus 22:20; Leviticus 20:10). The new, superior way of God's administering His moral absolutes is called grace.
Freedom from the moral aspect of the Mosaic Law does not involve freedom from the eternal, unchangeable moral absolutes of God. It only involves freedom from one way of God's administering His absolutes--namely through the Mosaic Law. If one is under God's grace, in administering His eternal, unchangeable, moral absolutes, one will not be lawless.
Although the Mosaic Law had three aspects (civil, ceremonial, and moral), it functioned as an indivisible unit. Thus, to place oneself under one aspect of the Mosaic Law is to obligate oneself to be under the entire Law. James declared "For whosoever shall keep the whole law, and yet offend in one point, he is guilty of all" (James 2:10). James was asserting that the breaking of only one part of the Mosaic Law made a person guilty of breaking the entire Law. The only way this could be true was if the Mosaic Law were an indivisible unit.
Therefore, nobody is saved by keeping the law...in any dispensation. Otherwise, why did Christ have to come and die for sinners? The rule in life for the believer is not the law of Moses but the life of Christ as revealed to us in the New Testament.
Galatians 2:21 I do not frustrate the grace of God: for if righteousness come by the law, then Christ is dead in vain.
Romans 13:14 But put ye on the Lord Jesus Christ, and make not provision for the flesh, to fulfil the lusts thereof.