We have all seen them at someone’s cottage (maybe even your own!): shelves loaded down with books or Cottage Life magazines that are valiantly doing their best to stay straight, but simply cannot.
Shelves will invariably sag if the span is too great for the load or if the shelf material is simply not robust enough.
If it’s the latter, and the shelves are not fixed, replace them. Harder woods such as maple will hold up far better to weight than softwoods like pine, though they will be almost double the price.
If your shelves are fixed, the simplest solution is to add brackets (check hardware stores), though this requires a good, solid back panel that will hold a screw. If that’s not the case, and if the shelf unit is tight to the wall, then you might be able to fasten the brackets directly through the back panel and into the wall studs.
Another fix consists of fastening a couple of pieces of 1×2 to the underside front, and back edges of the shelves to reinforce them. You can also double up the thickness of a shelf by affixing an identically sized piece to the underside; note that this will likely require the addition of a trim piece to the front to mask the join.
Finally, if the shelves are exposed, without a door (for example, in a pantry), add a vertical strut (or several), screwed to the front edges of the shelves.