The judges said that "this will require destroying the existing fence in certain places and building a new one," and ordered the government to provide a new route in a "reasonable period of time".
Bilin's residents and their Israeli and foreign supporters have protested at the barrier every Saturday for more than two years, with dozens of people being wounded in clashes with Israeli police.
The barrier's route through Bilin was completed despite the protests, with the Israeli government arguing that its position was designed to protect residents of Modiin Illit, an illegal Israeli settlement nearby.
Israel's defence ministry said in a statement that it would "study the ruling and respect it".
Israel's supreme court has ordered authorities to move the barrier in parts of the illegally occupied West Bank on several occasions.
Michael Sfard, the lawyer who organised the Bilin petition to Israel's supreme court, told Al Jazeera that the outcome was a clear victory for Bilin's villagers.
"Bilin became a symbol of the non-violent civil protest against the fence. Winning here was very crucial, not only for the villagers but also for the Israeli army, [who] lost," he said.
"I think we have seen in the last few months that the Israeli supreme does not believe the army automatically whenever it screams security considerations. This is a very positive sign for future legal battles."
Sfard said any proposed new route for the wall would be closely investigated to ensure it adheres to the court ruling.
Abdullah Abu Rahma, one of the leaders of the weekly protest at Bilin, said the ruling must be observed without delay.
"We want the decision to be implemented immediately," he said.
Israel started building the 680km barrier along the West Bank in 2002, saying it was necessary to prevent Palestinian suicide bombers from entering Israeli territory.
However, the barrier cuts into the Israeli-occupied West Bank and Palestinians say that Israel is using the barrier to grab their land.