In the time of the Shas, they used to gather in the city square on a fast day and pray there. Nevertheless, our sages, of blessed memory, said at the beginning of the fourth chapter of Megillah that it possesses no sanctity at all, because it is not a permanent fixture but rather an incidental occurrence. Based on this, the Tur and the Shulchan Aruch wrote that such is the law regarding houses and courtyards where people gather to pray incidentally—they possess no sanctity, see there. Based on this, our teacher, the Beit Yosef, wrote in section 2 that those who rent a house and pray in it—it does not have the law of a beit knesset. Thus far his words. And he was precise in his words to say "it does not have the law of a beit knesset," and he did not write "it possesses no sanctity" as before, for here it is not because of an incidental nature, as they rent it for a period of a year or more. Rather, the reason is that they do not have the power to make it a permanent beit knesset, as the Levush wrote, and this is his wording: For the physical structure is not owned by them, and today or tomorrow the landlord will take it back..., see there. For this reason he wrote that "it does not have the law of a beit knesset," meaning: the sanctity of a beit knesset and the laws of a beit knesset do not apply to it. But nevertheless, it is holy for its time, such that one may not perform a degrading act there. (So it appears in my humble opinion. And the Pri Megadim understood that the reason is because of an incidental nature, and he found difficulty with the words of the Levush, see there. But it is not so. And this is also the intention of the Ri Chaviv cited in the Beit Yosef and in the Taz, subsection 1. Examine carefully and you will find it simple.) (Also, regarding what the Taz and the Ri Chaviv wrote, that they should conduct themselves with cleanliness in the rooms above the place of prayer, according to what the Rema wrote at the end of siman 151—this applies only to a permanent beit knesset. And the Taz wrote there that the prayer does not ascend above when the place above is not clean, see there. And it is a measure of piety, and it is proper to be careful in this.)
בזמן הש"ס היו נוהגים שבתענית היו מתקבצים ברחוב של עיר והיו מתפללין שם. ומכל מקום אמרו חכמינו ז"ל בריש פרק רביעי דמגילה שאין בה קדושה כלל, לפי שאין זה קביעות אלא דרך אקראי. ועל פי זה כתבו הטור והשולחן ערוך דכן הדין בבתים וחצרות שמתקבצים בהם להתפלל באקראי – אין בהם שום קדושה, עיין שם. ועל פי זה כתב רבינו הבית יוסף בסעיף ב דהשוכרים בית ומתפללין בו – אין לו דין בית הכנסת. עד כאן לשונו. ודקדק בדבריו לומר "אין לו דין בית הכנסת", ולא כתב "אין בו שום קדושה" כמקודם, דהכא לאו משום אקראי הוא שהרי שוכרים לזמן לשנה או יותר. אלא הטעם דאין בכוחם לעשותו לבית הכנסת קבוע, כמו שכתב הלבוש וזה לשונו: שהרי הגוף אינו קנוי להם, והיום או למחר יקחנה המשכיר…, עיין שם. ולזה כתב ד"אין לו דין בית הכנסת", כלומר: קדושת בית הכנסת ודיני בית הכנסת אין עליו. אבל מכל מקום קדוש לשעתו, שאין לעשות שם דבר בזיון. (כן נראה לעניות דעתי. והפרי מגדים תפס דהטעם משום אקראי, ונתקשה בדברי הלבוש, עיין שם. ואינו כן. וזהו גם כוונת הר"י חביב שבבית יוסף ובט"ז סעיף קטן א'. ודייק ותמצא קל.) (גם מה שכתב הט"ז והר"י חביב שיתנהגו למעלה בבתים שעל מקום התפילה בנקיות, לפי מה שכתב הרמ"א בסוף סימן קנ"א – אין זה רק בבית הכנסת קבוע. והט"ז כתב שם שאין התפילה עולה למעלה כשהמקום למעלה אינו נקי, עיין שם. ומידת חסידות היא, וראוי ליזהר בזה.)