Praise be to Allah, and peace and blessings be upon the Messenger of Allah.
It is authentically reported from the Prophet ﷺ that Allah تعالى will judge between His creatures on the Day of Resurrection, to the extent that the wronged animal will receive retribution from the animal that wronged it. In the hadith:
“Retribution will certainly be taken for the hornless sheep from the horned sheep.” That is, the hornless sheep will receive retribution from the horned sheep, until all rights have been restored. Then it will be said to them: “Become dust.” At that point, the disbeliever will wish that he were dust. The scholars have authenticated this hadith.
It is also authentically reported that the Prophet ﷺ saw two sheep butting one another, and he informed his Companions that Allah تعالى would give one of them retribution against the other on the Day of Resurrection.
This retribution is not retribution based on legal accountability, reward, and punishment, because animals are not legally accountable. Rather, it is retribution intended to manifest justice and restore rights to their rightful owners.
Imam al-Nawawi, may Allah have mercy on him, stated that the gathering of animals is established, and that the retribution between them is not a matter of legal accountability. Rather, it is retribution by way of compensation, after which the animals will become dust.
This demonstrates the عظیم perfection of Allah’s justice: rights are never lost. If Allah سبحانه وتعالى will take retribution for one non-accountable animal against another, then what about the rights of accountable human beings? Therefore, a Muslim should beware of wronging people or violating their rights and should hasten to return people's rights before the Day of Resurrection.
And Allah تعالى knows best.