I remember a similar question that I asked my dad when I was little, "Can a policeman arrest a judge?" (since the judge is the one that sentences the ones who get arrested). The answer is yes, a policeman can arrest a judge.
Coherently, if a person is committing a crime he / she can be arrested. However, if a place is under martial law then I believe the military has more power over anyone. I doubt a situation would arise where the military personnel would be committing a crime under martial law; the situation would be too serious.