There are many things which expiate for sin, including repentance, seeking forgiveness, doing acts of worship, carrying out hadd punishments on those who have done acts for which such punishments are due, and so on.
But righteous deeds such as prayer, fasting, Hajj etc only expiate for minor sins, according to the majority of scholars, and they only expiate for transgressions against the rights of Allaah.
With regard to sins that have to do with the rights of other people, they can only be expiated by repenting from them. One of the conditions of repenting from them is restoring the rights of those who have been wronged.
Muslim (1886) narrated from âAbd-Allaah ibn âAmr ibn al-âAas (may Allaah be pleased with him) that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: âThe martyr will be forgiven for all his sins except debt.â
Al-Nawawi said in Sharh Muslim:
The words of the Prophet (peace and blessings of Allaah be upon him) âexcept debtâ draw attention to all rights owed to other people. Jihad, martyrdom and other righteous deeds do not expiate for transgressions against the rights of other people, rather they only expiate for transgressions against the rights of Allaah. End quote.
Ibn Muflih said in al-Furooâ (6/193):
Martyrdom expiates for everything except debt. Our Shaykh (i.e., Shaykh al-Islam Ibn Taymiyah, may Allaah have mercy on him) said: and except sins against other people such as murder and oppression. End quote.
It says in al-Mawsooâah al-Fiqhiyyah (14/129):
Repentance in the sense of regretting what one has done and resolving not to do it again is not sufficient to waive the rights that are owed to other people. Whoever has stolen another personâs wealth, or seized it by force, or has wronged him in any other way, will not have finished with the matter by simply regretting it, giving up the sin and resolving not to do it again. Rather he has to restore those rights. This is a principle on which the fuqahaâ are unanimously agreed. End quote.
This has to do with material possessions, such as wealth that has been taken be force or by deceit. With regard to intangible rights such as in cases of slander and backbiting, if the person who has been wronged knows about it, then it is essential to apologize to him and ask for his forgiveness. If he did not know, then he should not be told; rather the one who wronged him should pray for him and pray for forgiveness for him, because telling him may upset him and create enmity and hatred between the two.
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him) said:
According to the saheeh hadeeth: âWhoever has wronged his brother with regard to his blood, his wealth or his honour, let him come and set matters straight before there comes a Day on which there will be no dirhams and no dinars, only good deeds and bad deeds, and if he has good deeds (they will be taken and given to the one whom he wronged), otherwise some of the bad deeds of the one whom he wronged will be taken and added to his burden, then he will be thrown into the Fire.â This has to do with cases where the one who was wronged was aware of it; but if he was gossiped about or slandered and he does not know, then it was said that one of the conditions of repentance is telling him, or it was said that this is not essential, which is the view of the majority; both views were narrated from Ahmad, but his view on such matters is that one should do good deeds for the one who was wronged, such as praying for him, praying for forgiveness for him and doing good deeds to be given to him, to take the place of that backbiting and slander. Al-Hasan al-Basri said: The expiation for gossip is to pray for forgiveness for the person about whom you gossiped. End quote.
Majmooâ al-Fataawa, 18/189
The scholars of the Standing Committee said, concerning a man who stole money from a slave:
If he knows the slave or he knows someone who knows him, he can tell him to look for him and give him the money in silver or the equivalent, or whatever he agrees upon with him. If he does not know who he is and he thinks that he will never find him, he should give it or the equivalent in cash money in charity on behalf of its owner. If he finds him after that, he should tell him what he did; if he accepts that, all well and good, but if he objects and demands his money, then he should give it to him, and the money he gave in charity becomes an act of charity on his own behalf. He also has to ask Allaah for forgiveness and repent to Him, and pray for the other person.
Fataawa Islamiyyah, 4/165
And Allaah knows best.