It depends on the surgery and the type of exercise
, but generally, once the surgical site is healed and any muscle or joint issues have been rehabilitated, you can return to full exercise.
Talk with your surgeon for more specifics. Some types of exercise, not involving the surgical site, can often be started right away. Eg. Cv conditioning can be maintained with a hand bike after knee surgery.