He received the rudiments of his education in the schools of Portsmouth and at the Academy, in Norfolk; and upon the recommendation of Surgeon-General Lawson, United States Army, was appointed a cadet at large at West Point by President James Buchanan. His conditional appointment over the hand of Jefferson Davis, Secretary of War, was made on the 19th day of February, 1857, which directed that he should repair to West Point, in the State of New York, between the 1st and 20th of June, to be examined, and that under certain conditions in January next his warrant as a cadet, to be dated the 30th day of June, 1857, would be made. The conditions were fulfilled by creditable examinations and excellent deportment which secured the warrant as a cadet in the service of the United States, dated as promised over the hand of John B. Floyd, Secretary of War, January 22d, 1858. His course at the Academy was marked with creditable distinction; but the tocsin of war having sounded, and although within a month of graduation, he, with the heroic General James Dearing, the dashing General Thomas L. Rosser, and other noble spirits, left the Academy to give their services to their native States.
On May 1st, 1861, John Letcher, Governor of Virginia, commissioned W. F. Niemeyer Second Lieutenant in the Provisional Army of the State of Virginia, and on May 9th he was ordered by the Adjutant-General of Virginia to report to Major-General Walter Gwynn, commanding Virginia Forces at Norfolk; thereupon General Gwynn, on the 10th of May, ordered him to report to Colonel R. E. Colston, under whom he served as drill master at the entrenched camp, near Norfolk. On the 19th day of July, 1861, the President appointed him Second Lieutenant, Corps of Artillery, in the Army of the Confederate States over the hand of L. P. Walker, Secretary of War, C. S.; and his resignation as Second Lieutenant of Provisional Army of Virginia was accepted, to take effect on the 25th of July.
Samuel M. Wilson, a prominent citizen of Portsmouth, having been authorized by the Secretary of War to organize a battalion or regiment for the service of the Confederate States, called to his assistance the promising young lieutenant, whose military training was essential to Colonel Wilson's success.