Born in Borgo San Lorenzo, at the time in the Grand Duchy of Tuscany, he was the son of Francesco, Imperial Count and Florentine Patrician, titles which he would later inherit, and Maria Genta. His father had an active role in the Risorgimento, fought in the battle of Curtatone in 1848, and later become the first mayor of Borgo San Lorenzo of the newly founded Kingdom of Italy, in 1861. Guglielmo was the elder of three sons and a daughter: Alessandro, the only one who left male issues, Galeazzo, Gisella and Alfredo. Though he married twice, he died without issues, and the titles passed to his brother's heirs.
Military career
He attended the Italian Military Academy of Turin, becoming sub-lieutenant of Artillery in 1877, and was assigned to the 11th Artillery Regiment. In 1879 reached the rank of lieutenant, and moved to the 2nd Art. Regiment, where he served as adjutant-major. In 1884 was promoted captain and assigned to the Staff of Artillery Corps.
Colonial service
In February 1887 was transferred to the General Staff of the Army, and assigned to the African Special Corps of General Alessandro Asinari di San Marzano in Eritrea. In December 1891 he was promoted major of Infantry, and reassigned to the General Staff. In 1895 he returned in Africa, serving as a staff officer in the First Italo-Ethiopian War. While in the Eritrean colony he was promoted twice to the rank of Infantry Colonel. In 1900 he was appointed Chief of Staff of the VII Army Corps, and three years later was again sent in Africa as commander of the Regio Corpo Truppe Coloniali. Promoted Major General, from 1907 he commanded the Infantry brigades "Pisa" and "Cuneo". On the eve of the Libyan War he was promoted Lieutenant General and took command of the 1st Military Division in Messina.
After the outbreak of the Italo-Turkish War, the Kingdom of Italy sent in Libya an army corps, 34,000 men under the command of the seasoned general Carlo Caneva. The corps itself was formed by two divisions: Pecori Giraldi was appointed commander of one of them. During the fights for Tripoli, he led the right column in the successful Italian attack to Ain Zara, and in December 1911, was put in command of the conquered oasis' defenses. Wrongly informed about a group of local leaders who favored the Italians were being held captive in the nearby post of Bir Tobraz, he ordered colonel Gustavo Fara a sortie. The Italian column was trapped by Turks and local troops. Though he tried to blame Fara for this failure, he was questioned by a military commission and eventually relieved of command. He retired – or, as rumors said, forced to retire – at the end of the war. Although later cleared of all accusations, he was only listed among the Reserve officers.