Gilbert was established by William “Bobby” Gilbert, who provided land to the Arizona Eastern Railway in 1902 to construct a rail line between Phoenix and Florence, Arizona. Ayer’s Grocery Store, the first store in Gilbert, opened in 1910 and became the location of the first post office in 1912. The location of the town post office moved several times before settling on the east side of Gilbert Road in downtown, where it still stands today. In 1912, many Mormons who had fled the Mormon colonies in Mexico due to the actions of the forces of Pancho Villa settled in Gilbert. By 1915, they began holding church meetings at the Gilbert Elementary School. In 1918, they were organized into the Gilbert Ward.

Incorporated in July 1920, Gilbert was primarily a farming community fueled by the rail line and construction of the Roosevelt Dam and the Eastern and Consolidated Canals. It remained an agricultural town for many years and was known as the “Hay Capital of the World” from 1911 until the late 1920s.

In 2019, the town ranked highly on three national surveys, related to safety, livability, and family life; it was named the fourth-safest (of 182 communities), twelfth-most livable town, and seventh-best place to raise a family in the United States.