All dogs at some time need confinement to a crate, or an X-pen for recovery. Rest and a reduction in physical movements are required to enable the body to heal, and recover.
Keeping dogs calm, and occupied over this period is not only vital to their recovery, but their mental health. We don't want sad confined dogs, or conversely dogs confined and going stir crazy.
It's important to note here that you should always consult your dogs healthcare professional if you are unsure if a certain activity is suitable for your dog and it's circumstances.