The Sabbath law was very complicated for it even determined how many steps one could take. To complicate this even more the Jews began a collection of oral traditions which they attached to the scriptures. These they recorded in a book called the Mishnah which had no less than 12 tractates, 39 different prohibitions; things you could not do on the Sabbath. Among the many such prohibitions, four are connected with today’s Gospel; you could not reap, thresh, winnow or prepare a meal. However, according to the law, it was okay to pluck heads of grain by hand (Deuteronomy 23:25). Read also the ‘law of gleaning’ in the book of Ruth.
Interestingly the Pharisees criticized the disciples of Jesus and not Him directly. Besides eating grain in the gratified they should have picked on Him for breaking other laws of the Sabbath like exceeding the distance covered on the Sabbath (which incidentally the Pharisees broke too as they were shadowing Jesus). However, they chose rather to limit themselves to the actions of His disciples which they construed as working on the Sabbath.