In 1836, Bee's parents moved to Texas, which had achieved independence as the Republic of Texas. Bee remained in Pendleton living with his mother's three sisters to pursue his education. Bee graduated from the United States Military Academy on July 1, 1845, thirty-third in his class of forty-one and assigned as a brevet second lieutenant to the 3rd U.S. Infantry Regiment. He accumulated many demerits while at West Point, including several for chewing tobacco while on duty. Bee's first posting was to serve in the United States military occupation of Texas during the Mexican–American War. He was twice brevetted for gallantry in the War, first at Cerro Gordo to first lieutenant, where he was wounded, and then to captain at Chapultepec.