The Secretary of Defense serves at the pleasure of the President and does not have a fixed term. Typically, the Secretary’s tenure lasts as long as the President is in office, unless the Secretary is replaced or resigns before the President’s term ends.
For instance, if a new President is elected and they choose to appoint a different Secretary of Defense, the previous Secretary will step down. Conversely, it is also common for a Secretary to serve throughout the entirety of a President’s term if both parties are aligned in their policies and objectives. In recent history, some Secretaries have served for several years; however, others have had shorter tenures due to various political reasons.