I have joined gyms in the past and regretted it. The only gym that is worth its salt and is at a reasonable price is the YMCA. However, if your disciplined and have a piece of equipment then a gym is not necessary.
Gyms can certainly be worth it if you need the extra motivation and/or social interaction of working out around others who have similar goals for fitness, conditioning and competition. Depending on where you live, a gym membership can allow you to work out for the entire year and maintain your level of fitness -- an option that may not be very feasible in very cold or very hot climates. A good quality treadmill costs about $1000 so if I can get a good gym membership for $30-40/month. then I consider it to be a worthwhile deal, particularly if the gym also has a pool that member can use.