How do we know that? Matthew writes in Matthew 22:35-40:
35 And one of them, a lawyer, asked him a question to test him. 36 “Teacher, which is the great commandment in the Law?” 37 And he said to him, “You shall love the Lord your God with all your heart and with all your soul and with all your mind. 38 This is the great and first commandment. 39 And a second is like it: You shall love your neighbor as yourself. 40 On these two commandments depend all the Law and the Prophets.”
In v. 37, Jesus quotes Deuteronomy 6:5. But in v. 39, Jesus quotes Leviticus 19:18. Thus, the Golden Rule is based on the love commandment. The command to do to others is based on the command to love others. To do to others is to love others. To do to others is the same as to love others. To do to others is equivalent to love others.
Jesus said, “So whatever you wish that others would do to you, do also to them, for this is the Law and the Prophets” (Matt. 7:12). To do to others is the Law and the Prophets.
In the Hebrew Scriptures, the Law refers to the first five books of Moses—Genesis, Exodus, Leviticus, Numbers, and Deuteronomy. The Prophets refer to the: (1) Former Prophets (Joshua, Judges, Samuel, and Kings) and the (2) Latter Prophets (Isaiah, Jeremiah, Ezekiel, Hosea, Joel, Amos, Obadiah, Jonah, Micah, Nahum, Habakkuk, Zephaniah, Haggai, Zechariah, and Malachi). The Law and the Prophets thus refer to the Hebrew Scriptures, the OT.
Now Jesus teaches that the Golden Rule is the Law and the Prophets. The Law and the Prophets is summed up in this Golden Rule. The Golden Rule is the summary of the Law and the Prophets. It is the essence of the Law and the Prophets. In other words, that is the whole point of the OT Scriptures—to do to others what you wish others to do to you. To do to others, therefore, is an essential command.
A deacon living in a Berkshire town was requested to give his prayers in behalf of a poor man with a large family who had broken his leg.
“I can’t stop now to pray,” said the deacon (who was picking and barreling his early apples for the city market), “but you can go down into the cellar and get some corned beef, salt pork, potatoes, and butter; that’s the best I can do.”
Do not wait for others to do what we wish them to do to you. The kingdom ethic is a proactive ethic. Thus, do unto others what you want them to do to you. Everything you want others to do to you, keep doing it to them. This is sums up the Law and the Prophets—God’s Word.
 “Why He Did Not Pray,” Love for others sermon illustrations.” Cited August 9, 2015. Online: http://www.moreillustrations.com/Illustrations/love%20for%20others%201.html.