There were jubilant scenes after the verdict was finally announced
The court said the bushmen - or San people - were wrongly evicted from their ancestral homeland in 2002.
A panel of three judges ruled by two-to-one in their favour in the major issues in the case.
It is seen as a wider test of whether governments can legally move people from their tribal and ancestral lands.
The leader of the bushmen, Roy Sesana, emerged from court wearing traditional headdress and smiling broadly.
He told the BBC's Orla Guerin that he would return to the Kalahari to greet his ancestors within the next few weeks.
It is unclear how many of the San people will want to return. More than 1,000 were evicted four years ago.
'Unlawful and unconstitutional'
The bushmen are the oldest people in Sub-Saharan Africa.
Crowds of them had trekked overland to the court in the town of Lobatse to wait for the verdict, which was translated for them. There were scenes of jubilation as the result became clear.
"It's about the right of the applicants to live inside the reserve as long as they want - and that's a marvellous victory," said the bushmen's lawyer, Gordon Bennett.
The case was the longest and most expensive in Botswana's history.
The bushmen had argued that the government of Botswana acted illegally when it cut off their water supplies and drove them from the central Kalahari game reserve.
In a series of judgements that took all day to read, the High Court found in their favour.
Presiding judge Maruping Dibotelo told the court: "Prior to January 31, 2002, the applicants were in possession of the land which they lawfully occupied in the CKGR (Central Kalahari Game Reserve).
"The applicants were deprived of such possessions forcibly or wrongly and without their consent."
The government's subsequent refusal to allow the bushmen a permit to return to their land was "unlawful and unconstitutional", he added.
A lawyer for the government said an appeal against the verdict was an option, but at this stage the authorities would abide by the judgement.
The San people brought their case forward after being moved to functional but bleak settlements outside the Kalahari game reserve, where a new way of life was imposed.
The reserve was a poverty trap that denied them access to health and education, it said, arguing that the bushmen were better off in the settlements, where they had clinics and schools along with better access to food and water.
They also denied allegations that the bushmen were driven out to make way for diamond mining.
The bushmen's lawyer contends that although there are facilities in the camps, there is little for them to do.
"Almost everybody is dependent, to a greater or lesser extent, on handouts and that's a rather dispiriting experience," Mr Bennet said.