Born to a Hakka peasant family in Shaoguan, Guangdong, Xue joined the Tongmenghui in 1909. In the Spring of 1912, he was admitted to the Guangdong Military Primary School. In 1917, he was admitted to the sixth class of the Baoding Military Academy. However, in July 1918, he departed south for Guangzhou and joined an army created by Sun Yat-sen and Chen Jiongming with the rank of captain. Afterwards, he became commander of the first battalion of Sun's bodyguard. When Sun and Chen fell out, Xue escorted Soong Ching-Ling to safety.