(a) At any time during proceedings under this article the court may, upon its own motion or upon motion of the child or other parties, order the child or other parties to be examined by a physician, psychologist or psychiatrist, and may require testimony from such expert, subject to cross-examination and the rules of evidence: Provided, That the court shall not terminate parental or custodial rights of a party solely because the party refuses to submit to the examination, nor shall the court hold such party in contempt for refusing to submit to an examination. The physician, psychologist or psychiatrist shall be allowed to testify as to the conclusions reached from hospital, medical, psychological or laboratory records provided the same are produced at the hearing. If the child, parent or custodian is indigent, such witnesses shall be compensated out of the Treasury of the state, upon certificate of the court wherein the case is pending. No evidence acquired as a result of any such examination of the parent or any other person having custody of the child may be used against such person in any subsequent criminal proceedings against such person.
(b) If a person with authority to file a petition under the provisions of this article shall have probable cause to believe that evidence exists that a child has been abused or neglected and that such evidence may be found by a medical examination, the person may apply to a circuit judge or juvenile referee for an order to take such child into custody for delivery to a physician or hospital for examination. The application may be on forms prescribed by the Supreme Court of Appeals or prepared by the prosecuting attorney or the applicant, and shall set forth facts from which it may be determined that probable cause exists for such belief. Upon such sworn testimony or other evidence as the judge or referee deems sufficient, the judge or referee may order any law-enforcement officer to take the child into custody and deliver the child to a physician or hospital for examination. If a referee issues such an order the referee shall by telephonic communication have such order orally confirmed by a circuit judge of the circuit or an adjoining circuit who shall on the next judicial day enter an order of confirmation. Any child welfare worker and the child's parents, guardians or custodians may accompany the officer for such examination. After the examination the officer may return the child to the custody of his or her parent, guardian or custodian, retain custody of the child or deliver custody to the state department until the end of the next judicial day, at which time the child shall be returned to the custody of his or her parent, guardian or custodian unless a petition has been filed and custody of the child has been transferred to the department under the provisions of section three of this article.