Surgery is a set back for anyone and can be a slippery slope to inactivity. Getting back to physical activity will prevent this and improve long term healing. Before starting any program you should be cleared by your physician and have any limitations put into writing. Unless you are an avid exerciser it would be in your best interest to seek out a personal trainer to guide you until you feel comfortable to exercise on your on. The type and extent of the surgery will dictate what you can and can not do and the progression. Orthopedic surgeries might limit your ability to perform certain exercises or may require some therapy first. Surgeries to organs will carry with them their own set of limitations especially, cardiac surgeries.
Commencing a workout program should start with a functional screen to find any imbalances or limitations that may have been caused by the surgery. The corrections can be added to the warm up to restore balance. Depending on limitations you can then start on a basic program of general aerobic base building and whole body strength training. Aerobic training can start at 60-80% of max effort or a level where you can maintain a conversation for 30-90 minutes 2-3 times a week. Strength training can be performed 2-3 times a week using whole body movements such as squats. Once a solid base is built after 6-8 weeks you can start setting more specific goals and train towards them.