whose law does apply on US military bases? Denmark’s? Ghana’s?
Usually, we have Status of Forces agreements with the host government to determine those questions. They vary country to country and are the subject of bilateral negotiations. Certainly if a Danish citizen, an employee of the USG on the base, was caught in a crime, he/she would not be sent back to the US for trial and punishment under US law. Even US military personnel can be turned over to local authorities for trial and punishment if they commit a crime depending upon the SOFA and the nature of the crime, i.e., it involved a case against a host country citizen.