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?
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.
Adding a layer of mulch such as dry leaves is the first thing you can do right away. I did this for my raised hills of squash, and beds for garlic and sweet potatoes.
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.