In the official continuity, the shrine is where Prince Yosho Masaki Jurai trapped the space pirate Ryoko after landing on Earth following the battle of planet Jurai. He took on the name Katsuhito Masaki, became its shinto priest, and guarded the shrine for 700 years until he tricked his grandson Tenchi into releasing Ryoko in hopes that he would take his place on Jurai. Afterwards, it is still used as a place of worship.
In the Tenchi Universe continuity, the Masaki Shrine is still the place where Prince Yosho settled after arriving on Earth from Jurai. Instead of being a prison for Ryoko, it was a prison for Washu Hakubi, who, in this continuity, was a mad scientist with the means of destroying countless planets and was sealed in the shrine by the Galaxy Academy. Upon arriving on Earth, Yosho recognized that the "goblin" inside of the shrine was Washu and decided to be trained by the Masaki family to become its guardian. Once again, he took the name Katsuhito Masaki.
In the Tenchi in Tokyo continuity, the shrine is simply a place of worship. Tenchi moves to Tokyo in order to train to take over as the priest/guardian of the shrine. The shrine was not a prison for anyone until the end of the series where Tenchi placed the sleeping antagonist Yugi who would sleep there until she reached a maturity where she could control her various powers.