The meaning of legalism, as used by religious writers, denotes 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. Anyone thought to obey, literally, God's commands, such as keeping the seventh-day Sabbath holy, are deemed indulging in legalism. 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 people as being involved with legalism 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. not eating 'unclean' foods, etc.) but do not view or treat them as a way to earn or preserve their salvation. While some may still label such people as being involved in legalism, the Bible does not.
Surprisingly, the last book of the Bible bears witness to the fact that before the return of Jesus there will be those still obeying God's laws. Additionally, it is only those who keep the commandments (who the world will label as practicing legalism), as witnessed to in Revelation, that will be given eternal life.
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.). Others, however, still may consider them believing in legalism.