You can do any or all of a staggering number of things, some unique combination of which may help you. Otherwise, feet should both be flat on the floor. Like any athletic pursuit, using a keyboard requires warm-up exercises such as neck and shoulder rolls and hand and arm stretches to promote flexibility. Once you have injured yourself, however, you must have a set of exercises prescribed for you by a physical therapist, that are specifically designed to help with your problem. In fact, if your injury is acute, you may not even be able to go near your keyboard for anywhere from three weeks to three months.
Some people manage to injure themselves so badly they can never type again, period.
Both the severity and type of injury will determine this. Easier said than done. And of course, a certain amount of chronic pain. Still, I consider myself fortunate. Now at least, I can type for five or ten minutes at a time.