In 1827, Taylor joined the United States Navy as a midshipman, serving aboard the USS Fairfield during her Mediterranean deployment from 1828 to 1831. When the ship returned to the U.S., he resigned from the Navy and entered his family's mercantile business. With the outbreak of the war with Mexico in 1846, he became a captain in the 10th U.S. Infantry under Zachary Taylor the following year. While in Mexico, he developed a reputation for discipline and order among his men. He also cultivated a strong friendship with Philip Kearny, a fellow future Civil War general.
