Could you still play sports like tennis if you have carpal tunnel syndrome?

Yes but... If you have carpal tunnel in your serving wrist, playing may worsen the symptoms. You can play, but you may worsen the symptoms and the nerve compression. Even tight gripping with the opposite hand may contribute to more stress and strain on the flexor tendons around the nerve and make symptoms worse there, too. See a hand surgeon if your symptoms are not getting better.
Yes. Tennis does not typically aggravate the symptoms of carpal tunnel syndrome. If you find the symptoms are getting worse after you play i would recommend limiting the amount of tennis.