To be in contempt of court, you have to disobey willfully a legally allowable demand of the court. A legally allowable demand of the court could include instruction to attend court, to deliver up certain documents, or even as simply to be quiet during a court hearing where you have no right to speak. Contempt of court is usually dealt with by giving you a time limit to put that contempt right, however if you continue to disobey wilfully, the penalties can incur detention until such time as you agree to put the contempt right - in most cases just the threat of detention causes the contempt to be sorted quickly. The court is not permitted to ask you to do something out of your range of ability to do it or that the court is not permitted to do so - for example if you are giving birth you could not be jailed for failing to attend court - it is always based on reasonable demands.