There were a few different ways of keeping food before refrigerators.
Most recently (just before modern refrigerators became very common) people used iceboxes. These were like refrigerators but instead of being cooled electrically, they were cooled by having actual ice in them.
Before that was available, people had cool cellars and some had ice houses where ice could be stored (under sawdust, often) and kept cool for much of the year. These places could keep some food cool.
But mostly, in those days, food was preserved some other way -- by smoking it, salting it, or drying it.