If your baby died before during or soon after the birth, when you go home from the hospital will depend on what you feel comfortable with, how well you are and if you had a Caesarean or vaginal birth. You should be allowed to stay in the hospital for the normal 4 to 6 days if this is what you would prefer but you can also go home sooner if you want to and are well enough.
Usually the hospital will arrange for a midwife to visit you at home (if you don't have your own private midwife) to check your recovery and see how you are doing. The social worker should also be able to see you at your home (presuming you live relatively close to the hospital) and will help with advising you on any arrangements and usually offer some counselling.
For many women who stay in hospital after their baby has died they can find the experience upsetting and isolating. The staff will usually try and give you a single room away from where the mothers and new babies are. This could be on the antenatal ward (pregnant women with heath concerns) or the gynaecological ward (non pregnant women having operations). If you are in a rural hospital they may move you to a general ward within the hospital. Some women find the hospital 'protective' from friends and family that the woman feels she needs 'space' from.
If you are physically well enough and you would prefer to be at home with your partner or family, it is not unreasonable to go home within 4 to 6 hours after a vaginal birth and 36 to 48 hours after a Caesarean. If you wish to take your baby home with you, this can also be arranged (being aware that you may need to accommodate an autopsy being performed if this is needed). If the baby is under the jurisdiction of the Coroner's Court this will not be possible until after the autopsy.