Do US Naval Academy graduates have to enlist in the military?

People who are invited to attend the US Naval Academy in Annapolis, Maryland, and begin their naval schooling are enlisted in the Navy the first day of attendance. Service begins in the Summer before the Fall semester. They are schooled first on navy sailing ships.
Academy graduates become Commissioned Officers, not enlisted sailors. Though there is a similar contract, an officer can resign a commission, while an enlisted sailor cannot quit. Also, an enlistment is a signed contract between the sailor and the Navy; a commission is given by Congress.

The agreement that is signed by a midshipman (whether at the Academy or through NROTC) says they will serve in the US Navy for six years in exchange for the education. If the individual does not meet the requirements for a commission, due to poor grades, poor leadership or other reasons, they can be enlisted to serve the 6 years. Typically there is a 4 year active duty requirement and that the remaining is done in the reserves.