When the Pharisees heard that he had silenced the Sadducees, they gathered together, and one of them [a scholar of the law] tested him by asking,

“Teacher, which commandment in the law is the greatest?”

He said to him, “You shall love the Lord, your God, with all your heart, with all your soul, and with all your mind.

This is the greatest and the first commandment.

The second is like it: You shall love your neighbor as yourself.

The whole law and the prophets depend on these two commandments.

In Luke:

He said in reply, “You shall love the Lord, your God, with all your heart, with all your being, with all your strength, and with all your mind, and your neighbor as yourself.” (Luke 10:27)

In Romans:

Owe nothing to anyone, except to love one another; for the one who loves another has fulfilled the law. The commandments, “You shall not commit adultery; you shall not kill; you shall not steal; you shall not covet,” and whatever other commandment there may be, are summed up in this saying, [namely] “You shall love your neighbor as yourself.” Love does no evil to the neighbor; hence, love is the fulfillment of the law. (Romans 13:8-10)

In Galatians:

For the whole law is fulfilled in one statement, namely, “You shall love your neighbor as yourself.” (Galatians 5:14)

Other religions too have their own “Golden Rule” that are almost similar to the one taught by Jesus. I am giving below a few examples.

In Bahá’í Faith

Lay not on any soul a load which ye would not wish to be laid upon you, and desire not for any one the things ye would not desire for yourselves. (Gleanings From the Writings of Bahá’u’lláh, LXVI: Fear God, ye inhabitants of the City, Constantinople)

Blessed is he who preferreth his brother before himself. Verily, such a man is reckoned, by virtue of the Will of God, the All-Knowing, the All-Wise, with the people of Bahá who dwell in the Crimson Ark. (KALÍMÁT-I-FIRDAWSÍYYIH / Words of Paradise, Tenth leaf)

Wish not for others what ye wish not for yourselves; fear God, and be not of the prideful (Kitab-i-Aqdas – Verse 148, part 4)

Buddhism

Hurt not others in ways that you yourself would find hurtful. (Tripitaka Udānavarga 5:18)

… For a state that is not pleasant or delightful to me must also be to him also; and a state that is not pleasing or delightful to me, how could I inflict that upon another? … (Samyutta Nikaya v.353)

In five ways should a clansman minister to his friends and familiars, …. by treating them as he treats himself.(Sigalovada Sutta 31)

Confucianism

Do not do to others what you would not like yourself. Then there will be no resentment against you, either in the family or in the state. (Analects 12:2)

Tse-kung asked, “Is there one word that can serve as a principle of conduct for life?” Confucius replied, “It is the word ‘shu’ – reciprocity. Do not impose on others what you yourself do not desire.” (Analects 15.23)

When one cultivates to the utmost the principles of his nature, and exercises them on the principle of reciprocity, he is not far from the path. What you do not like when done to yourself, do not do to others. – Doctrine of the Mean 13.3 (Li Ki 28.1.32, SBE 38.305)

Try your best to treat others as you would wish to be treated yourself, and you will find that this is the shortest way to benevolence. (Mencius VII.A.4 )

Hinduism

“This is the sum of Dharma [duty]: Do naught unto others which would cause you pain if done to you.” (Mahabharata, 5:1517)

“One should not behave towards others in a way which is disagreeable to oneself. This is the essence of morality. All other activities are due to selfish desire.” (Mahabharata, Anusasana Parva 113.8)

In Islam

On the authority of Anas bin Malik, the servant of the messenger of Allah, that the prophet said: “None of you [truly] believes until he wishes for his brother what he wishes for himself.” (#13 of An-Nawawi’s Forty Hadiths)

Jainism

“A man should wander about treating all creatures as he himself would be treated.” (Sutrakritanga 1.11.33)

“One should treat all beings as he himself would be treated.” (Agamas Sutrakritanga 1.10.13)

Judaism

Take no revenge and cherish no grudge against your own people. You shall love your neighbor as yourself. I am the LORD. (Leviticus 19.18)

Do not keep with you overnight the wages of those who have worked for you, but pay them at once. If you serve God thus, you will receive your reward. Be on your guard, son, in everything you do; be wise in all that you say and discipline yourself in all your conduct. Do to no one what you yourself hate. Do not drink wine till you become drunk or let drunkenness accompany you on your way. (Tobit 4.14-15)

“That which is despicable to you, do not do to your fellow, this is the whole Torah, and the rest is commentary, go and learn it.” (Rabbi Hillel, 30 BC – 10 AD)

Native American Spirituality (Native Spirituality)

Do not wrong or hate your neighbor. For it is not he who you wrong, but yourself. (Pima Proverb)

Taoism

The good man ought to pity the malignant tendencies of others; to rejoice over their excellence; to help them in their straits; to regard their gains as if they were his own, and their losses in the same way. (T’ai Shang Kan Ying P’ien, 3)

To those who are good to me, I am good; to those who are not good to me, I am also good. Thus all get to be good. To those who are sincere with me, I am sincere; to those who are not sincere with me, I am also sincere. Thus all get to be sincere. (Tao Te Ching)

Unitarianism

We affirm and promote respect for the interdependent web of all existence, of which we are a part. – Unitarian principle

Zoroastrianism

Whatever thou dost not approve for thyself, do not approve for anyone else. When thou hast acted in this manner, thou art righteous. (Shayast-na-Shayast 13:29)

“That nature alone is good which refrains from doing unto another whatsoever is not good for itself”. (Dadistan-i-dinik 94:5)