I was off work a few years back with a prolapsed disc causing sciatic nerve compression (the injury was caused at work). I could barely walk, get out of bed, put socks on, turn over in bed....it was absolutely agony.
My job involves a lot of manual handling and working in difficult spaces. I was unfit for work. I was, however, going swimming each morning. It was the only movement I could do without being in extreme pain. It kept me mobile, kept my back supple and got me out of the house. Because swimming is non-weight bearing it was the only exercise I could do. I could barely do the exercises my physio gave me to do due to pain, stiffness and muscle spasm. But swimming really helped.
Work, my GP, my physio and OH department were all aware of what I was doing and actively encouraged it. My employers saw it as me being pro-active to getting back to work because it was the only thing I could do. Yes it was absolute agony getting to the pool and I really struggled getting in and out of the car, but the benefits really made it worthwhile.
If I'm ever in the same situation again I wouldn't hesitate to get back in the pool.
However, it entirely depends on your job role. I was unfit for my particular job, and as soon as I was more mobile I went onto alternative duties until I was fit do do my role again.