‘Rest in Peace’ comes from the Latin epitaph ‘Requiescat in pace’. It is an idiomatic expression wishing eternal rest and peace to someone who has died. 
The phrase has only been commonly found on gravestones, in it’s English form, since the 18th century; generally on those gravestones belonging to Roman Catholics. Being a translation of the Latin words ‘Requiescat in pace’, it has however existed for longer than that. Those words appear several times in the Requiem Mass and form part of the Roman Catholic burial liturgy, this being the reason that so often it has been found inscribed upon Roman Catholic gravestones. ‘Requiescat in pace’ – translated as, Rest in peace – was an offered prayer to God, in the hope that the soul of the deceased person would find peace in the next life. Simply a prayer for the dead. 
Theologically, the eternal rest and peace here is referring to the ‘afterlife’ – which rules out the atheists, as they don’t believe in life after death. The Abrahamic scriptures are quite clear in stating that physical death is not the end, there is an afterlife; there exist Heaven and Hell. However, “eternal peace” is understood differently in each religion.
In Judaism, Kaddish – the prayer extolling God that is said by mourners – is recited for Jews and may certainly be recited for non-Jews; “Rest in Peace (RIP)” is included in that – an act of kindness.  This is in line with their creed in which they do not believe in eternal punishment.
In Christianity, “Rest in Peace (RIP)” has been traditionally associated with purely Roman Catholic epitaphs. It was used *only* for those who died as ‘Roman Catholic’ but it is now not uncommon for Christians to also use it – for Christians only, not for non-Christians. This is because they believe (based on their scripture) that eternal bliss is for the believers and eternal-damnation for the non-believers. “About God’s children they can say with confidence, ‘Rest in peace’”.  However, Christians are to refrain from using it as only God knows what’s in a person’s heart and whether the person in his or her last moments cried out to Jesus for forgiveness or not. [5a]
In Islam, “Rest in Peace (RIP)”, was never used by Prophet Muhammad (Peace be upon Him) or any of His Companions. Islam is not a progressive religion, rather a conservative one. When the Prophet’s ﷺ son Ibrahim passed away, He ﷺ cried profusely and it is narrated that He ﷺ said, “the eyes shed tears and the heart feels sorrow but we will only say what pleases our Lord.” So we do not say anything that displeases our Lord. The Sunni legal orthodoxy is of the view that one is not allowed to pray for the unbelievers, as they will reside in the fire of hell and their actions in this world are void. This is because such actions were neither intended to seek the pleasure of God, nor for the hereafter.  However, God says in the Qur’ān “As for those who desire the life of this world and its finery – We will give them full payment in it (this world) for their actions. They will not be deprived of their due.” 
The Prophet ﷺ said:
“None of you believes until he wants for his brother what he would want for himself.” 
This Hadīth (Prophetic tradition) is the last of the four ahādīth that constitute the famous “Sum of Good Adab” (The first three being; to speak little; to mind one’s own business; and not to be angry). 
Imām an-Nawawī said in explanation of the above Hadīth:
“It is better for that [saying of the Prophet ﷺ] to be interpreted in the sense of universal brotherhood, so that it includes the non-Muslim and the Muslim. Thus he wants for his non-Muslim brother what he would want for himself…” 
The dominant opinion in Christianity appears to be that a Christian should not pray for a non-Christian person after their death. Similarly, the dominant opinion in Sunni legal orthodoxy is that a Muslim should not pray for a non-Muslim person after their death.
Our theology might be different, but that doesn’t make anyone less of a human being. I cringe at the arrogant, insensitive, and dismissive comments made by some Muslims upon hearing of the death of a non-Muslim. Some even backbite/slander the deceased. That’s not from our tradition.  The Prophet ﷺ would stand out of respect for a Jewish funeral procession. He was asked about it and He ﷺ said, “Wasn’t he a soul?” 
 Definition of rest in peace from the Cambridge Advanced Learner’s Dictionary & Thesaurus©. Cambridge University Press.
 Wikipedia. Rest in Peace. [Online] Available from: http://en.wikipedia.org/w/index.php?title=Rest_in_peace&oldid=584219496. [Accessed December 6, 2013]
 Andrew McDonald. Should Christians use the phrase Rest in Peace, April 2013. [Online] Available form: http://protestant-standard.blogspot.co.uk. [Accessed December 6, 2013]
 Rabbi Paul Citrin. Jewish Burial and Mourning Practice for non-Jewish relatives, 2000. [Online] Available from: http://www.interfaithfamily.com. [Accessed December 6, 2013]
 Got Questions Ministries. Is it biblical to say ‘rest in peace’ (RIP) in regards to someone who has died. [Online] Available from: http://www.gotquestions.org. [Accessed December 6, 2013]
 W. Charkawi. ‘Some of the Rulings Upon An Unbeliever’. In: The Beneficial Message & Definitive Proof in The Study of Theology, pp. 306
 Qur’ān 11:15
 Related by Bukhārī, Muslim, Ahmad and others.
 Ibn Abī Zayd al-Qayrawānī, as related by Imām an-Nawawī in his Minhāj of Hadīth (2:210)
 Nawawī, Sharh Arba’īn, 123. And Muhammad Afifi al-Akiti. The meaning of universal brotherhood by Imam an-Nawawi. [Online] Available from http://qa.sunnipath.com. [Accessed December 6, 2013]
 Ify Okoye. How Muslims don’t express condolences. Available from: http://ifyokoye.com [Accessed December 6, 2013]
 Sahīh Bukhārī 1250 and Sahīh Muslim 961