Confidential statements made in confession to a religious advisor are privileged in every U.S. state and in federal court.
There is a body of law that surrounds each kind of privilege (attorney-client, psychotherapist-patient, doctor-patient, priest-parishioner, accountant-client, husband-wife) that covers exceptions to the general rule. At least a couple of privileges (attorney-client and husband-wife) actually involve more than one distinct privilege: attorney-client privilege has a confidential communications component and a work product component that have different rules; a husband-wife privilege has a confidential communications component and a 5th Amendment like component that allows one spouse to refuse to permit the other current spouse to testify against him or her.
The privilege for confessions made to priests is generally speaking, broader than the attorney-client privilege. Both attorney-client privileges have crime-fraud and prevention of imminent harm exceptions that do not apply to priests. The work product component of the attorney-client privilege also has an exception when work product is the sole available source of critical information available by no other means (e.g. due to the fact that destructive testing was conducted on evidence).
A judge cannot order a priest to disclose to a grand jury or any other tribunal or official, what was said in confession, and the priest could not be held in contempt for not testifying in this manner. Indeed, even if, for example, a secret microphone had been placed on a suspect and captured his confession to a priest, the recording of that conversation would not be admissible as evidence in any legal forum due to the privilege.
Often, as in the case of a seal of confessional for a Roman Catholic priest, a privilege is also accompanied by a duty on the part of the person receiving the confidential information to keep the information disclosed confidential. But, the duty to keep privileged communications confidential does not always exactly match the scope of the privilege.
For example, a Mormon minister's religious obligation to keep confessions confidential might not be precisely the same as those of a Roman Catholic priest, even though confessions to either one would be privileged from compulsory disclosure in a court or other tribunal. Similarly, confidential communications to an attorney can be disclosed by an attorney in furtherance of the representation in a way that a confidential communication to a priest usually could not be disclosed.
In at least some jurisdictions, the priest could probably be compelled to testify regarding whether an individual came to a place at a given time to confess (which would establish alibi or lack thereof, and proximity to the time scene at a particular time) since that itself wouldn't be a confidential matter shared with the priest and could have been witnesses by anyone else in the church building who was not a part of the confession whether it not it actually was witnessed by anyone else. In such a jurisdiction, if the priest refused to testify regarding that matter, the priest could be held in contempt of court just like any other witness under a subpoena who refused to testify.
The law is not entirely clear over the extent that the priest-parishioner privilege is mandated solely by a statute, common law rule, or court rule (as the case may be from state to state, this varies considerably), and to which extent the statute, common law rule, or court rule providing for the privilege is constitutionally mandated by the free exercise clause of the 1st Amendment to the United States Constitution (incorporated to apply to the states through the 14th Amendment to the United States Constitution), and by parallel state constitutional provisions.
The question of whether the priest-parishioner privilege is constitutionally mandated matters because some states, in the wake of scandals involving sexual abuse of children by clergy, have sought to extend the requirement that a designated person knowing of instances of child abuse must report their suspicions to authorities, that applies to many kinds of licensed professionals who deal with children in most states, to religious officials who deal with children and their supervisors and colleagues in their churches or denominations.
If the question is constitutional, it might be the case that these laws would be unconstitutional. Middle ground might find that there might be a duty of someone taking a confession from a priest to report child abuse (because this is an abuse by the priest of the privilege of receiving privileged confessions), but not a duty to report child abuse disclosed in confession by anyone else. Of course, if there is no constitutional dimension to the privilege, the legislature is free to modify it with legislation as they see fit.
There is also an issue in every particular privilege regarding whom the privilege belongs to, and hence, who has a right to legally waive a privilege and allow testimony concerning the confidential communications to be provided. It might belong to the person making the confession, it might belong to the priest, or it might belong to both (hence requiring mutual consent for a waiver of privilege and not just consent by one individual who holds the privilege). I am not familiar with the state of the law in every jurisdiction regarding who holds the privilege for confidential communications with clergy.