Everybody's bodies are different and some shouldn't be playing when they're older, but I think many can/should. I play with a group of 40-60 year olds twice a week. Basketball is great for side-to-side strengthening of muscles that I often overlook when I just go running. The bouncing/start-stops variability strengthens your back and joints (contrary to what many think, you don't weaken knees from things like running, you actually strengthen them).
Now, you do have to play differently. You have to be careful about going airborn, and you want to minimize falls. But you can adjust your game and still play.