I haven't been on bedrest, but I have read about it. It can last up to the birth of the child, depending on why you were put on bedrest. Bedrest can also last as long as your problem persisits. Once it has gone, or gotten much better, you will be taken off bedrest and back on restrictions.
I hope you are better and don't have to resort to bedrest.