German military law has a long history.
Drumhead courts-martial in the German lands had existed since the Early modern period. During the Thirty Years' War several Imperial states established military tribunals modelled on the jurisdiction of the Swedish Army. In Brandenburg-Prussia, justice was dispensed by special Auditeur attorneys through three official channels.
After the Prussian-led Unification of Germany, the German Empire with effect from 1 October 1900 established a particular court-martial jurisdiction (German: Militärgerichtsbarkeit) to try soldiers of the German Army, with the Reichsmilitärgericht (RMG) in Charlottenburg as the supreme court. In Prussia it replaced the Generalauditoriat agency, while the Kingdom of Bavaria retained the right to pass judgements to members of the Bavarian Army by a separate (the 3rd) senate. The presiding judge in the rank of a general or admiral was appointed directly by the German Emperor.
During World War I, German military law enabled military courts to try not only soldiers but also civilians held to have violated the military law. Especially well-known is the case of Edith Cavell, the English nurse court-martialled and executed in occupied Brussels in 1915 for having helped POW's escape - which was indeed a capital offence under the German military law of the time.