Can you get contempt of court when the custodial parent refuses to return the child when there is a court order?

If the custodial parent refuses to obey the visitation order the non-custodial parent can file a motion for contempt.

No argument intended, but only the presiding judge can issue a contempt order and that generally does not happen.

If the non-custodial parent refuses to return the child, the usual procedure is for the custodial parent to first contact the child protection/enforcement agency for assistance. A social worker accompanied by police who have jurisdiction where the minor child is in residence will contact the non custodial parent and request the release of the minor to them. After a preliminary investigation of the circumstances they usually transport the minor child/children to the primary custodian .

However, if there are circumstances which suggest the minor may have been endangered and/or neglected in either household he or she will remain in state's custody. All such action is reported to the court. A hearing is scheduled where all parties are required to attend. The judge will decide at that time what action if any should be implemented.