When any action has been commenced against an officer with a view to trying such officer by court-martial and such officer is to be separated or retired in accordance with this chapter, the Secretary of the military department concerned may delay the separation or retirement of the officer, without prejudice to such action, until the completion of the action.