Gardening is a great way to be active and work your joints and muscles, but if done improperly can lead to injury. The first thing to be aware of is your overall level of physical activity. If you spend most of your days sitting in an office chair you don't want to then spend an entire weekend outside doing hard physical labor. Your body needs time to adjust and you are better of spreading the work out over a few days, preferably as something you do every few days. Not only does this staggered approach reduce your risk of injury but it also helps offset the negative side effects of the modern sedentary life.
When doing the actual work you want to be protective of your back. If you have to carry any heavy loads try to use a tool like a wheelbarrow. If you have no other choice remember to stand upright, relax your shoulders, pull in your abs and breathe regularly. Be mindful of the weight you are trying to carry. If you wouldn't normally pick up a 30lb dumbbell at the gym, you might want to ask for help carrying a 30lb potted plant.
Most of all, whatever you do, don't spend a lot of time bent over. You are going to put excess pressure on your spine and round-out your back, increasing your risk of a major issue. Invest in a gardening chair like the one pictured above, which can be used both for sitting to work on higher plants and for kneeling to work on the ground. If you have an exercise ball lying around, you can also try Hussain's technique of lying with your stomach on it while working on the ground with your hands. You should also be mindful of your neck and avoid prolonged periods of looking down.
Lastly, don't hesitate to setup your garden with your physical health in mind - with hanging pots and raised beds.