Volume 3, Book 39, Number 528 :
Narrated by ‘Aisha (radiallaahu `anhaa)
The Prophet (sallallaahu `alayhi wasallam) said, “He who cultivates land that does not belong to anybody is more rightful (to own it).” ‘Urwa said, “Umar (radiallaahu `anhu) gave the same verdict in his Caliphate.”
Land that has no owner and does not serve and purpose– such as watercourses, places where firewood is gathered, grazing land and public amenities – may be taken possession of by reviving it, because the Prophet (blessings and peace of Allah be upon him) said: “Whoever revives disused land, it becomes his.” Narrated by Abu Dawood (3073) and at-Tirmidhi (1378); classed as hasan by al-Haafiz Ibn Hajar in Buloogh al-Maraam (897); he also mentioned other isnaads for this hadeeth in al-Fath (5/19), then he said: There is some weakness in its isnaads, but they strengthen one another. See also Irwa’ al-Ghaleel (5/553).
Reviving land may be done by building fences around it, digging a well in it and extracting water from it, or diverting a stream of water to it.
It says in Zaad al-Mustaqni‘: The one who encloses disused land, or digs a well in it and finds water, or brings water to it from a spring, and the like, or diverts water away from it in order to cultivate it, has revived it. End quote. See also ash-Sharh al-Mumti‘ (10/329).
Taken from IslamQA