The hospital is where your spartan gets sent to automatically when his health reaches 0%. You also may end up in the hospital from a scouting turn, such as getting beat up by a treaveler.
Your health regenerates while you are in the hospital, but you cannot access many of the games functions while there.Though, you can still send and recieve items, use the mailbox, post in the forums, and chat in the shoutbox.
The amount of time you spend in the hospital depends on how you ended up in there. For example, being beat up by another player puts you in for around 30 minutes, while being 'hospitalised' by another player will keep you in the hospital for over and hour.
The time you spend in the hospital cna be shortened by using a Medpack. This item can be obtained by taking a class (explore>base hq>spartan education). The class takes one week to complete, costs $2,000,000, and can be repeated. The class gives the player 3 Medpacks each time.