I have several raised beds for vegetables and I don't walk on them but they still compact over time from watering.
What can I add to the soil to keep it from compacting?
Gardening & Landscaping Stack Exchange is a question and answer site for gardeners and landscapers. It only takes a minute to sign up.Sign up to join this community
Elliot Coleman used a broadfork for this. I'm adding this link for the pictures not because I endorse the product You can make your own there are DIY tutorials online for that.
What might help would be using drip irrigation and a heavy layer of mulch. I'd also work in as much organic matter as I could acquire every year or two. This will help prevent the soil compaction... Also avoid chemical fertilizers and pesticides that might harm the soil life. These critters aerate your soil for you but can't if you're bypassing their purpose with chemicals.
Watering does create a pan on the top of the soil, and this needs to be broken up from time to time. Usually this is simply done by forking over the ground, lightly if there's stuff growing in it already. Do it as soon as you see a pan forming - quite often it will form after one lot of watering if that watering is done with a can, especially one without a rose. Work off boards laid on the soil rather than walking all over it if you can, otherwise, fork up where you've walked as you back off the bed rather than leaving compacted footprints.
Earthworms. This may be politically incorrect, depending upon who you talk to, but I'd add earthworms to the beds - and as earlier commentators mentioned, avoid chemical fertilizers and pesticides so you don't kill them. The worms will not only burrow, loosening the soil, they'll carry organic material from the surface deep into the soil. Red Wigglers are NOT suitable for this, but if you search for "buy earthworms online," you'll find a number of other options.
Probably the best way to prevent soil compaction is to ensure that the soil is completely covered at all times. Ideally, you want some sort of layer of vegetative growth at all times, but in the absence of vegetation, some leaf litter or a loose mulch can cover the ground.
There are many different ways of achieving vegetation cover. One of my favorites is to grow low-growing, shade-tolerant crops such as strawberries, parsley, or various greens. The three sisters method uses squash for this purpose. You can use all sorts of other plants other than food plants too; if you're not going to grow a food plant, try to find plants native to your area that have a low maximum height so that they won't compete with your taller food plants.
If you don't have vegetation cover at any point in time, put down a loose mulch. Leaf litter is great if you have leaves in autumn. You can use cut up waste from the garden itself, if you're growing plants where there is no risk of diseases propagating from the fallen litter. I usually avoid buying mulch or accepting external mulch, but if you do use external mulch make sure it's loose and just enough to cover the soil. If you put too much mulch down or if you use a dense, hard mulch, not only can it hold too much moisture, but it can prevent burrowing insects from accessing the soil, and you want those insects. If you compost, occasionally work some compost into the soil or use it as a mulch. The added material not only can cover exposed soil, but can add some nutrients back into the system, replenishing what is lost when you harvest things.
Another factor that can improve soil structure is ensuring that you have some deep-rooted plants in the mix. One reason I like growing carrot-family plants like parsley and fennel, is that they tend to have deep taproots. Also, I like to always have at least one kind of legume in my garden. Beans are the easy one. These will add a lot of nitrogen to the soil, generally making it more fertile and biodiverse.
The more biodiversity you have in your garden, the better the soil structure will be. Leave any native weedy plants that are small enough that they're not shading out your plants, but pull out invasive plants, especially ones that tend not to be eaten by insects. You want a lot of insects so that they are burrowing in the soil, as that will improve the structure. Consider trimming back native weeds instead of pulling them; this avoids exposed soil and soil disturbance.
Also, try to mix together the plants you grow, like instead of having all the tomatoes grouped together, mix them up with other plants, especially ones from unrelated families like beans, or okra, or whatever else you're growing. Not only will this slow the spread of pests from one plant to another, but the total biodiversity will create a broader range of insects which means more things burrowing in the soil and improving the structure.
Lastly, make sure to leave some dead plant stalks in winter, after harvest, ideally leaving them as late as you can, only clearing them out when you need the space. This will help more insects overwinter. And avoid using insecticides! Never! You want lots of critters in there, so they're constantly burrowing and so that there are enough predators that they will keep any pests under control.