That depends on where.
Around here (Massachusetts and North), cattle generally are in the barn in the winter. However further south and west, they may winter over outside, particularly if of a tough breed. One problem is that they may have trouble reaching feed through deep snow. Perhaps you have seen pictures of airplanes and helicopters dropping bales of hay to them when the snow is much deeper than expected. When you get enough south so there is little or no snow, why worry?
What about the midwest states?
How do the farmers make a living in winter if all the crops are snowed over and the livestock have to stay inside? What do they do?
In the midwest states, farmers depend upon the harvesting of their crops or livestock to make a living. Many small farmers also have other part time jobs.
During the winter, they still have to feed and care for the livestock, repair buildings, fences, machinery, and do their planning and bookkeeping.
You make little money shipping wheat when the snow is deep. Farming is a seasonal business. Traditionally one borrows money in the spring to plant crops, and pays it back at harvest time in the fall. There are all kinds of more sophisticated ways to make money ahead, such as selling futures on your corn crop. You sell your anticipated corn to a buyer on what is called a "commodities exchange" (look that up on google or other search engine.) The buyer then owns a certain amount of your future crop and has paid you for it. If your crop is bigger than that, you will have more to sell in the fall. If your crop is smaller due to bad weather or whatever, you will have to borrow corn to pay the person who has already bought your corn before it is grown. Therefore you should not sell more corn futures than you expect to grow in general.
If you run a dairy farm, the cows give milk in the barn. Other livestock may also do fine in the barn. In any case there is plenty to do feeding and tending them. (Manure for example, and babies)
By the way, there are also commodity futures on cattle, hogs (the notorious pork bellies) etc, so a farmer can make money on crops and livestock that will not be ready to ship until later, but always with the risk of not being able to deliver on the delivery date.
Even if a farmer only grows crops and no animals, there is a lot of work maintaining a farm and equipment. Also some farmers take other full or part time jobs in the winter.