Self-Incrimination
The 5th Amendment of the US Constitutions prevents the state from forcing an individual to testify against himself in a criminal proceeding.  This is called the privilege against self-incrimination. Thus the prosecutor cannot force a defendant to testify in a criminal trial.  It only protects against testimony, not against access to property and information other than that contained in the person's head.  Thus the court can order a person to undergo a DNA test without violating this privilege, and a person can be forced to turn over diaries if the police have a search warrant.
There is no privilege against self-incrimination for civil matters and or the the state has granted the person the immunity for criminal prosecution.  If a person refuses to testify when there is no threat of criminal prosecution, the court can hold him in contempt and keep him in jail until he testifies.  If a person refuses to testify in an administrative hearing, the agency cannot punish him solely for failing to testify.  The agency can rule against the person if his testimony was is important to defending his position against the agency.  For example, if a physician is being investigated by the board of medical examiners and he refuses to answer their charges because he is worried about being prosecuted in a  criminal case, the board can suspend his license if there is not other evidence to rebut their charges.  They cannot suspend his license solely because he refuses to testify.
For a more detailed discussion, see: Hoover v. Knight, 678 F.2d 578 (5th Cir.(Fla.) 1982)