But he said to them: Have you not read what David did when he was hungry, and those who were with him, how he entered the house of God and ate the loaves of the presentation, which it was not lawful for him to eat, nor for those who were with him, but for the priests alone? To refute the false charge of the Pharisees he recalls the old history, when David, fleeing Saul, came to Nob and, received by Ahimelech the priest, asked for food; and he, since he had no common loaves, gave him consecrated ones, which it was not lawful to eat except for the priests and Levites alone, and he asked only thi...s, whether the young men were clean from women; and when David answered, since yesterday and the day before, he did not hesitate to give the loaves, judging it better (as the prophet says: I desire mercy and not sacrifice) to free men from the danger of hunger than to offer sacrifice to God. For the salvation of men is a victim pleasing to God. So the Lord sets this against them and says: If David too is holy, and Ahimelech the high priest is not blamed by you, but both transgressed the command of the law with an acceptable excuse, and hunger is the cause, why do you not approve in the apostles the same hunger that you approve in the others? Although even in this there is a great difference: these rub ears of grain in their hands on the Sabbath; those ate the levitical loaves, and the days of the new moons were added to the solemnity of the Sabbath, on which, being sought at the banquet, he fled from the royal court. Note that neither David nor his young men received the loaves of the presentation before they had answered that they were clean from women.
Source: Commentary on Matthew