This was written by songwriter Jimmy Webb, who also wrote Campbell's hits "By the Time I Get to Phoenix" and "Wichita Lineman." Webb also wrote "MacArthur Park," which was a hit for both Richard Harris and Donna Summer, and "Up-Up and Away," which was recorded by The 5th Dimension.
Galveston is a city on the coast of Texas that attracts lots of hurricanes. Webb was on a beach in Galveston when he wrote this. He made up the story about a soldier in the Spanish-American war and the girl he left behind.
The Vietnam War was going on when Campbell released this. It was considered an antiwar song.