A court-martial is a special legal trial for members of the military. When someone in the armed forces is accused of a crime, they are usually subject to court-martial.
Court-martial is the official name of a military court, or for a trial within that kind of court. Active military members are subject to a separate set of laws from civilians, and part of that military legal process involves facing a judge in a court-martial. Criminal offenses like theft and assault are tried this way, as are military-specific crimes like desertion. Martial means "pertaining to war."