If medical therapy fails, if there are chronic severe symptoms, or if there is a complication, a surgery may be needed. In Crohn's disease, the goal is to save as much of the intestine as possible, as the disease often recurs close to the operation site. In ulcerative colitis, the entire colon may be removed, which cures the illness. In most cases, a stoma outside the body is not needed.
IBD patients whom have had surgery are usually in very poor physical condition, so the starting situation is not good. Physical activity after surgery must be started with very light exercise.
Until a month after any abdominal surgery, lifting or carrying heavy loads, performing sudden movements, and performing any strenuous exercise is forbidden, as these may cause a hernia. You should start very light exercise, such as walking very short distances 2-3 weeks after surgery and increase the intensity gradually. After a month you can try something slightly more strenuous such as an exercise bike, and then slowly return to your normal activities.
For further reading:
Höckerstedt, K., Färkkilä, M., Kivilaakso, E. & Pikkarainen, P. (1998). Gastroenterologia. Duodecim: Jyväskylä.