There aren't really too many other places they could go.
Centaurs, as magical creatures, need to live somewhere well away from Muggles so as not to break the International Statute of Secrecy. They are also fairly secretive creatures with no great love of witches and wizards either. The Forbidden Forest, which was isolated and impossible for Muggles to reach, really was a perfect location. Hogwarts exists partly to give a home to magical creatures like centaurs for whom a natural habitat would otherwise be hard to find.
The grounds of Hogwarts function partly as a nature reserve for magical creatures which have difficulty existing in Muggle-inhabited areas.
(Pottermore, "The Great Lake").
Since avoiding Muggles is something that centaurs and wizarding schools both have an interest in it seems natural that they would co-exist in the same areas to one degree or another.
As a general rule, magical schools tend to be situated in landlocked, mountainous areas (although there are notable exceptions, as will be seen), as such regions are difficult for Muggles to access, and easier to defend from Dark wizards.
(Pottermore, "Wizarding Schools").
I'm not too sure we can know whether the school predates the centaurs or the centaurs predate the school. There's no real canon information that I'm aware of as to why Hogwarts was built where it was, or whether the centaurs were there to begin with. There is an false answer on one of the W.O.M.B.A.T. quizzes that Rowling wrote that says that "The Forbidden Forest began life as a wood planted and tended by a centaur herd" (thanks to ibid for the reference). All that really rules out is that the Forest was made for the centaurs. If the centaurs were already at Hogwarts then we have no way of knowing the reasons why the founders might've chosen to teach near the centaurs. All we can be sure of, I think, is that the centaurs and the school had a mutual interest in sharing the land around Hogwarts. The centaurs largely kept to the Forest; the wizards and witches largely kept to the school.
We know from Umbridge that the Ministry of Magic was fine with the centaurs being there. From the Ministry/the school's point of view the centaurs largely kept to themselves and so could roam freely around the Forest.
“What are you doing in our forest?” bellowed the hard-faced gray centaur whom Harry and Hermione had seen on their last trip into the forest. “Why are you here?”
“Your forest?” said Umbridge, shaking now not only with fright but also, it seemed, with indignation. “I would remind you that you live here only because the Ministry of Magic permits you certain areas of land -"
(Order of the Phoenix, Chapter 33, Fight and Flight).
From the same passage we can deduce that the centaurs regarded the Forbidden Forest as being "our forest". They clearly saw it as their home. I doubt that they would take kindly to ever being invited to leave.