If this wealth or treasure has markings on it which indicate that it was buried during the Jaahiliyyah, i.e. before Islam, whether it was the wealth of the Romans or the Persians or anyone else, then in this case one fifth of it (khums) must be given in charity, because the Prophet (blessings and peace of Allah be upon him) said: “On rikaaz (buried treasure) the khums (one fifth) must be paid.”
Narrated by al-Bukhaari, no. 1499.
Shaykh al-Islam [Ibn Taymiyah] said: They [the scholars] are agreed that the khums must be paid on buried treasure, as is proven in the saheeh hadeeth from the Prophet (blessings and peace of Allah be upon him). The rikaaz (buried treasure) concerning which there is no doubt is that which was buried during the Jaahiliyyah; it is treasure that is buried in the ground.
End quote from Majmoo‘ al-Fataawa, 29/376
The issue of buried treasure has been discussed previously in the answer to question no. 83746
But if this treasure was buried by Muslims, then it comes under the heading of lost property and it must be announced and its owners sought for one whole year. If its owners cannot be found, then it becomes the property of the one who found it, provided that he will return it to its owner if he finds him after that.
It says in al-Mawsoo‘ah al-Fiqhiyyah (23/102):
There is no difference of opinion among the fuqaha’ that things buried by Muslims come under the heading of lost property.
It is known [to belong to the Muslims] if it has Islamic markings on it, or the name of the Prophet (blessings and peace of Allah be upon him) or one of the Muslim caliphs or governors, or a verse of the Qur'aan, and the like.
It says in al-Mughni: If it has some Islamic markings on part of it and some non-Islamic markings on part of it, it is also lost property, because what appears to be the case is that it came into the possession of a Muslim and it is not known that it went out of the Muslims’ possession, so it is like the case where the entire item has Islamic markings throughout.
What seems to be the case is that this is not the view of the Hanbalis alone; rather it is the view of the other fuqaha’ also, as is clear from their comments on recognising buried treasure of the Jaahiliyyah.
Ibn al-Qayyim said: Anything that has no markings on it comes under the heading of lost property, because it is most likely to belong to Muslims.
End quote from al-Turuq al-Hukamiyyah, 1/291
For information on the rulings on lost property, please see the answer to question no. 5049.
If treasure is found in a house or a land that one has bought or been given as a gift, the scholars differed as to who owns the treasure.
The majority of fuqaha’ are of the view that it belongs to the former owner or his heirs if they are alive, because the treasure was placed in the ground, and when he took possession of it [the land] he took possession of whatever was in it, and what was in the ground did not cease to be owned by him when it was sold.
Imam Ahmad -- according to one report --, Abu Yoosuf and some of the Maalikis were of the view that the buried treasure that is left after paying the khums belongs to the later owner, because the treasure did not come into the possession of the one who bought the land, because it was deposited in it; rather it comes into the possession of the owner of the land at the time when it is found.
End quote from al-Mawsoo‘ah al-Fiqhiyyah, 23/106
Ibn Qudaamah al-Maqdisi regarded the second view as correct, then he said: Because buried treasure is not owned merely by buying the house, because it is not part of the house; rather it was deposited in it. Therefore it comes under the heading of things that are permissible for anyone, such as grass, wood, and game that one may find found in the land of others and take them, thus becoming more entitled to them.
End quote from al-Mughni, 2/327
This is also the view favoured by Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) when he said: With regard to this matter, it seems that it belongs to the one who finds it. … and that is because it is separate from the land, so it does not come under his ownership. Thus it belongs to the one who finds it, just as if he found truffles or something that comes out of the ground; it belongs to the one who finds it.
End quote from his comments on al-Kaafi, 3/108
And Allah knows best.