While you should take it easy after surgery, after you've recovered, you will probably feel stiffness, and reduced range of motion around the location of the surgery. There may also be a build up of scar tissue that causes discomfort.
Stretching is a good complement to exercise in general. It prevents stiffness, and overly-tight muscles as you grow stronger. But it's especially helpful for anyone who has recovered from surgery.
Start slow, and move in the direction of the stiffness, and stop when you meet resistance or feel tight. Then hold that position. You can gently try to stretch a bit further, as long as you don't feel any pain. Gentle stretching is a great way to get back the range of motion you had before surgery, or at least you can come close.
Talk to your doctor about what areas feel tight, and what stretching exercises they would recommend for you.