First, the assumption was that the Earth's rotational period was 86400 seconds. Mechanical clocks had given us no reason to doubt this was so.
By the mid-20th century quartz timers were able to discern that the Earth has longer and shorter days, as numerous factors cause the spin to speed up or slow down. Instead of a single day the second was taken to be one 86400th part of an average day over the whole year.
A few decades later the availability of atomic clocks made this seem silly and we uncoupled the second from the variably spinning Earth. The completely arbitrary seeming atomic clock definition of a second was basically chosen to be indistinguishable from our last guess at the "averaged over a year" second.