Yes, you can do Kegel exercises sitting on a pilates ball, as long as you maintain good posture.
However, it is usually easier and more comfortable to start by doing the Kegel exercises lying down with your knees bent and, when you have some practice and some strength, to do the exercises sitting down.