Jesus Himself was always posing the question, "Is it lawful to heal on the Sabbath?" Why was that the case?  Jesus was trying to show us that human life is precious and a matter of priority - the  weightier matters of the law. As a matter of priority, a violation of the Sabbath or any other commandment for the sake of compassion and mercy is not to be seen as being in antithesis to the law. Breaking of the Sabbath was a capital offense and a transgression surrounding it was taken very seriously. Jesus was showing that there were times that transgression of the law was justified.  He was not negating the law. He stated in Matthew that He did not come to abolish the law. He was trying to point out that where matters of life are concerned, that preservation of life is above the law. That compassion and mercy were of the highest order and greater than all the meticulous observance of the law. He did say however, that both should be done but with the higher priority to be placed on human life. That is not the same thing as cancellation the law that God established. He used the examples of David and the priests to make his case. We should not set out to violate God's laws, but when faced with an immediate need to alleviate suffering and to preserve life, one can be justified in breaking a law to do so. It is the concept of the ox in a ditch. These instances of doing that which is not lawful to do, are to be few and rare - but Jesus established a case and showed us example of where it is appropriate.