Acting Defense Secretary Patrick Shanahan has withdrawn from consideration to head the US military, President Donald Trump announced on Tuesday.