Seconds came first. Since ancient times (Egypt or Babylon) people divided the day into 24 parts and then sub-divided by 60 and by 60 again. This unit is defined in relation to the rotation of the earth (which was later found to be slowing, so it got redefined).
With seconds established, someone realized that a pendulum has the same period regardless of the weight attached. The meter was defined to be the length of a pendulum with a period of two seconds, or a half-period of one second.
Unrelated, but grams were defined to be the weight of one cubic centimeter of water at (I believe) freezing/melting temperature.
Imperial units:
Well, these come from all sorts of places. Miles comes from paces, which are related to the height of a man.
Conclusion:
SI units are derived from Earth's rotation and gravity, imperial units are derived from functional and human characteristics. Unless you believe that the proportions of the human body are related to other things in the cosmos directly (DaVinci tried to show this) then it's just a coincidence.