I have plantar fasciitis, a painful foot condition, so I understand where you're coming from. If you have leg pain I'm guessing that exercise bikes are out. Could you go swimming instead? The buoyancy of the water may help your legs, depending on the cause of your leg problems. Some pools have water aerobics classes that may help.
Another option is an exercise pedal
. If your goal is to increase your heart-rate then exercise pedals are quite good. Most people use them for their legs, like a reclining stationary bike, but you can use them to pedal your arms too. The one I've linked to is quite light-weight. I bought one for cheap online (not from that link, though) but to be honest it's too light. When I try to use it the damn thing scoots away from me! There are heavier types that are expensive but allow for greater tension so you get a better work-out. Googling 'exercise pedal' should come up with a few options for you.
Do you do any weight work? Depending on your medical condition lunges and squats may be too much, but you might find working your upper body with hand-weights suits you. Sit-ups and push-ups should be okay too.
The most important thing is to check your exercise routine with your doctor before trying anything. You don't want to make your condition worse!