Born in
New York City, he joined the Navy on April 24, 1839, and served as a
midshipman aboard the frigate (1839–1840) and the sloop (1840–1843) in the
Mediterranean Squadron, before returning to the U.S. aboard the sloop in 1843 to attend the
Naval School at Philadelphia, graduating with the rank of
passed midshipman on July 2, 1845. He served through the
Mexican–American War on the
frigate in the
Pacific Squadron, serving on operations around
Mazatlán, during the time that it was occupied by U.S. naval forces between November 1847 to June 1848. Baldwin was promoted to
commander in November 1862, given command of the steamer in early 1863 He was then assigned to ordnance duty, serving at the
Mare Island Navy Yard in California until 1867. He returned to sea as the
Fleet Captain of the
North Pacific Squadron in 1868–1869, and received promotion to the rank of
captain in 1869. ==Personal life==