Legalism is a word used by religious writers to denote any system of belief that suggests a believer must obey God and his laws (e.g. the Ten Commandments) as a prerequisite to receiving his grace and salvation. Many Christians believe that Jesus, Paul and the rest of the New Testament teaches that God's laws were abolished (done away with) and that they are no longer valid for believers. Their version of obedience amounts to deciding for themselves what they 'feel' is the right or loving thing to do in a given situation.
Some religious leaders have gone so far as to label something as legalism, or a person as legalistic, if they accept some Old Testament laws (e.g. the ten commandments) or principles (e.g. tithing) as applying to them. There are, however, believers who accept and obey God's laws (e.g. worshipping God on Saturday, not eating 'unclean' foods, etc.) but do not view or treat them as a means to earn or preserve their salvation. While some may still label such people as legalistic, the Bible does not. In fact, the last book of the Bible bears witness to the fact that before the return of Jesus their will be those still obeying God's laws. And, surprisingly, it is only those who keep the commandments (as witnessed to in Revelation) that will be given eternal life.
17. Then the dragon (representing Satan in the end time) was furious with the woman (the spiritual organism known as the church of God) and went to make war with (and to kill) the rest of her seed (true Christians), who keep the commandments . . . (Revelation 12)
14. Blessed are those who keep His commandments (the ten commandments, including the fourth one), that they may have the right to eat of the tree of life . . . (Revelation 22)
Some churches and groups may reject most, if not all, of God's Commandments and replace them with THEIR OWN set of church sanctioned 'commandments' that must be followed (e.g. no card playing, dancing, drinking alcohol, etc.). They still may be considered by others, however, as being legalistic.