A monastery was a religious retreat, usually isolated, and normally home to monastic groups devoted to the ideals of their order. Monasteries were prevalent throughout the races of the Alpha and Beta Quadrants, particularly among those races with more spiritual societies.
In 2151, Captain Jonathan Archer claimed that the oldest monastery that he ever visited was in Ngari, Tibet. It was significantly smaller then the Vulcan P'Jem monastery. (ENT: "The Andorian Incident")
While visiting Earth during the mid-22nd century, Doctor Phlox attempted to familiarize himself with many of the planet's religions including Buddhism, which he accomplished by spending two weeks at a Tibetan monastery where he learned to sing chords with the high lamas. (ENT: "Cold Front")
The Klingon monastery at Boreth was central to the legend of Kahless the Unforgettable and his promised return. In 2369, Worf visited the monastery in an attempt to rediscover his Klingon heritage. It was there that Kahless apparently returned from Sto-vo-kor, although it was later revealed that he was a clone. (TNG: "Rightful Heir") Worf visited the planet again in 2371 following the destruction of the USS Enterprise-D. (DS9: "The Way of the Warrior")