Kitzur Shulchan Aruch, Rabbi Shlomo Ganzfried
Chapter 85 : Laws Pertaining to a Fire That Breaks Out on Shabbos
If, Heaven forbid, a fire breaks out on Shabbos, our Sages were concerned that the head of the household and his family [who are] in the vicinity of the fire, will be occupied with rescuing their belongings. They will be hasty and panicky at the prospect of losing their valuables, and, as a result, forget that it is Shabbos, and they might extinguish the fire. They, therefore, forbade rescuing even objects that are [normally] permitted to be handled. They forbid even to move them to a place where it is permitted to carry. Only that which is needed for the day is permitted to be rescued. For instance: If a fire broke out on Shabbos eve before the [Shabbos] meal, you may rescue [enough] food for three meals, [food] fit for humans — for humans, [food] fit for animals — for animals. [If the fire broke out] in the morning, [you may rescue] food for two meals. [If the fire broke out] in the afternoon, [you may rescue] food for one meal. If one vessel contains much food [i.e. more than you need], for example, a basket full of breads, or a barrel full of wine or something similar; since you can remove it [all] at the same time, it is permissible [although you are rescuing more than you need]. Similarly, if you spread a sheet or something similar, and gather into it everything you can remove, even quantities of food and drink, and you remove them all at once, it is permissible. You may also remove all the utensils that you need to use on that day [Shabbos].
You may say to others: "Come and rescue [something] for yourselves, and each person may rescue the food that he needs, or a vessel that contains even a great amount [of food] and it will belong to the rescuer, since the owner renounced his ownership, and he [the rescuer] acquired it from ownerless property. If he [the rescuer] is a God-fearing person and returns to the owner that which he rescued because he knows [that the owner] did not willingly renounce ownership, he may receive payment for the rescue and it is not considered Shabbos wages, since, legally, it is all his. Nevertheless, it is virtuous not to accept payment for the trouble of rescuing [anything] on Shabbos, although it is not [considered] Shabbos wages, because a virtuous person should give up his rights concerning anything that has the slightest taint of sin.
All that was said above applies only [when taken] to a place to which it is permitted to carry things. But, to a place where it is forbidden to carry, it is forbidden to rescue anything. However, clothes that you can wear may be put on, and you may wrap everything you can around you and carry them out even to a public domain. Then, you may remove the clothing, [return] and again put on clothes and carry them out. [You may do this] even the entire day. You may also tell others: "Come and rescue!" to and they, too, may rescue.
Since the owners of the houses that are near the fire are less panicky even though they are afraid that [the fire] will also reach them, they may rescue everything [by taking it] to a place where it is permitted to carry. Some say that money as well as other valuables, though they are muktzeh, may be rescued from a great, sudden loss, such as a fire, a flood or a robbery, by placing on them some food item, and handling them together in that manner. (However, under other circumstances, there is no allowance whatsoever to handle muktzeh in this manner.) There are those even more lenient [who rule] that the valuables themselves may be handled, because where a great sudden loss [is involved] the prohibition of muktzeh is set aside provided that you do not carry them out to a place wherein it is forbidden to carry.
All sacred books, whether they be handwritten or printed, may be rescued from a fire, a flood, and the like, even to a yard or an alleyway to which it is forbidden to carry due to the lack of an eiruv; provided the yard or alley is constructed in a manner that an eiruvei chatzeiros or shitufei mevo'os could be set up. It is permitted to use a non-Jew to rescue these books even [if it means] carrying through a public domain. (Salvaging the dead from fire is discussed further on in Chapter 88, paragraph 16.)
You may rescue the book-bag along with the [sacred] book, and the tefillin-bag along with the tefillin.
A Seifer Torah should be rescued before other books.
When life is endangered you may extinguish the fire. Therefore, in areas that Jews reside amongst non-Jews, you may extinguish the fire even if it is in a non-Jew's house. It all depends on the circumstances. Only extinguishing is permitted, but it is prohibited to desecrate the Shabbos to save some valuables. If you violated the law and did desecrate [the Shabbos], you should consult a rabbi to learn the way of repentance.