The amount of time you are required to serve depends on many factors. These factors include your interests, your background, your pursuit of an Officer or Enlisted position, or whether you are taking advantage of [Navy education opportunities].
For the most part, Enlisted positions typically require an initial service commitment of two to four years.
In general, Officer positions typically require an initial service commitment of three to five years.
The best way to confirm specific service commitment that will apply to you is by contacting a recruiter.