The name “Nogales” is derived from the Spanish word for “walnut” or “walnut tree.” It refers to the large stands of walnut trees that once stood in the mountain pass where Nogales is located.

Nogales was at the beginning of the 1775-1776 Juan Bautista de Anza Expedition as it entered the present day U.S. from New Spain, and the town is now is on the Juan Bautista de Anza National Historic Trail. On the second floor of the 1904 Nogales Courthouse is a small room dedicated to the 1775-76 Anza Expedition.

In 1841, a land grant from the Mexican government to the Elías family established Los Nogales de Elías. Following the Gadsden purchase in 1853, Nogales became a part of the United States of America. In 1880, Russian immigrant Jacob Isaacson built a trading post at present-day Nogales. The U.S. Postal Service opened the Isaacson post office but renamed it as Nogales in 1883.

On August 27, 1918, a battle between United States Army forces and a Mexican Army Garrison aided by German military advisors occurred.