Lewis Wallace (April 10, 1827 - February 15, 1905) was an American lawyer, Union general in the American Civil War, governor of the New Mexico Territory, politician, diplomat, and author from Indiana. Among his novels and biographies, Wallace is best known for his historical adventure story, Ben-Hur: A Tale of the Christ (1880), a bestselling novel that has been called "the most influential Christian book of the nineteenth century." Wallace's military career included service in the Mexican-American War and the American Civil War.

Lewis "Lew" Wallace was born on April 10, 1827, in Brookville, Indiana. He was the second of four sons born to Esther French Wallace (nee Test) and David Wallace. Lew's father, a graduate of the U.S. Military Academy in West Point, New York, left the military in 1822 and moved to Brookville, where he established a law practice and entered Indiana politics. David served in the Indiana General Assembly and later as the state's lieutenant governor, and governor, and as a member of Congress. Lew Wallace's maternal grandfather was circuit court judge and Congressman John Test.  In 1832 the family moved to Covington, Indiana, where Lew's mother died from tuberculosis on July 14, 1834. In December 1836, David married nineteen-year-old Zerelda Gray Sanders Wallace, who later became a prominent suffragist and temperance advocate. In 1837, after David's election as governor of Indiana, the family moved to Indianapolis.  Lew began his formal education at the age of six at a public school in Covington, but he much preferred the outdoors. Wallace had a talent for drawing and loved to read, but he was a discipline problem at school. In 1836, at the age of nine, Lew joined his older brother in Crawfordsville, Indiana, where he briefly attended the preparatory school division of Wabash College, but soon transferred to another school more suitable for his age. In 1840, when Wallace was thirteen, his father sent him to a private academy at Centerville, Indiana, where his teacher encouraged Lew's natural affinity for writing. Wallace returned to Indianapolis the following year.  Sixteen-year-old Lew went out to earn his own wages in 1842, after his father refused to pay for more schooling. Wallace found a job copying records at the Marion County clerk's office and lived in an Indianapolis boardinghouse. He also joined the Marion Rifles, a local militia unit, and began writing his first novel, The Fair God, but it was not published until 1873. Wallace said in his autobiography that he had never been a member of any organized religion, but he did believe "in the Christian conception of God".  By 1846, at the start of the Mexican-American War, the nineteen-year-old Wallace was studying law at his father's law office, but left that pursuit to establish a recruiting office for the Marion Volunteers in Indianapolis. He was appointed a second lieutenant, and on June 19, 1846, mustered into military service with the Marion Volunteers (also known as Company H, 1st Indiana Volunteer Infantry). Wallace rose to the position of regimental adjutant and the rank of first lieutenant while serving in the army of Zachary Taylor, but Wallace personally did not participate in combat. Wallace was mustered out of the volunteer service on June 15, 1847, and returned to Indiana, where he intended to practice law. After the war, Wallace and William B. Greer operated a Free Soil newspaper, The Free Soil Banner, in Indianapolis.

Answer the following question by taking a quote from the article: When did he join the military?
but left that pursuit to establish a recruiting office for the Marion Volunteers in Indianapolis.