Growing distrust on the part of Muggles for wizards and witches compels the four greatest witches and wizards of the age – Godric Gryffindor, Helga Hufflepuff, Rowena Ravenclaw, and Salazar Slytherin – to found Hogwarts. Ravenclaw is said to have dreamed of a warty hog leading her to a particular cliff overlooking a loch, thereby indicating where the school was to be built (CS9).
Binns says in 1992 that Hogwarts was founded "over a thousand years ago" and that "the precise date is uncertain." We can assume, then, that Hogwarts -- and Hogsmeade -- were founded around 900 AD.
Interestingly, stone castles didn't exist in Britain before 1000 AD, and certainly not in Scotland. One might assume, then, that either Wizards invented them a century before Muggles did, or that Hogwarts didn't exist in castle form in the earliest years.