The length of a day is determined by the time it takes for the Earth to complete one rotation on its axis, so the true question is whether the Earth’s rate of rotation has remained constant over time.

The Earth and Moon are ‘tidally locked’: they behave as a ‘double planet system’ and rotate around a common centre of gravity. The Earth rotates on its axis once every 24 hours while revolving around the Earth-Moon centre of gravity, also known as barycentre, once every 28 days. Additionally, the Earth-Moon pair orbits the Sun once every 356 days.  

About 9 billion of years ago, the average day on Earth was only about 19 hours.  The tidal force of the Moon causes tidal friction on Earth, pulling ocean water towards the Moon and creating a tidal bulge on one side of Earth. The tidal bulge ends up always being 3° ahead of where it should be, imperceptibly slowing Earth’s rotation but speeding up Moon’s rotation, thus adding about 2.3 milliseconds to the day every century.  The friction effect causes the Moon to slowly distance itself from Earth over time. 

So, the duration of a day as 24 hours is a result of our current definition of a day based on the Earth’s rotation. However, throughout history and depending on how we define a ‘day’, the length has varied.

Solar Day: this is the 24-hour period we commonly refer to, based on one complete rotation of the Earth relative to the Sun. It’s the basis for our common concept of a day, which includes both daylight and nighttime.

Sidereal Day: to complete one full rotation relative to the distant stars, Earth needs a little less than 24 hours. This is slightly shorter than a solar day (about 23 hours, 56 minutes, and 4 seconds) and is based on the Earth’s rotation relative to distant stars. 

Historical Perspectives: in ancient times, different civilizations had various ways of measuring days. Some used lunar cycles, others divided days into smaller or larger units of time, which could vary in length.  The origin of the 24-hour day is mainly attributed to the Egyptians: the ‘clock’ was divided into 12 hours of daytime and 12 hours of night-time (or alternatively 10 hours between sunrise and sunset, an hour for each twilight period and 12 hours of darkness). This is known because of various sundials from the period which have been found to be marked with hours. This means that hours started out changing in length with the seasons (as the amount of daylight vs. darkness changes).

There is a more in-depth explanation for the division of night-time into 12 hours which is based on the number of ‘decan’ stars which were seen to rise during summer nights in Ancient Egypt. A ‘decan’ star was a star which rose just before sunrise at the beginning of a 10-day ‘decade’ in Ancient Egypt. 36 ‘decan’ stars marked the passage of a year for the Egyptians (or 36 x 10-day periods). During summer nights, 12 ‘decan’ stars rose – one for each ‘hour’.

However, hours did not have a fixed length until the Greeks decided they needed such a system for theoretical calculations. Hipparchus proposed dividing the day equally into 24 hours which came to be known as equinoctial hours (because they are based on 12 hours of daylight and 12 hours of darkness on the days of the Equinoxes).

Changes over Time: due to factors such as tidal friction and other gravitational influences, the Earth’s rotation has gradually slowed down over billions of years. This means that in the distant past, days were shorter than they are now. However, this change is very gradual and not noticeable within recorded human history.

So, while the concept of a 24-hour day is a modern standard based on solar time, the actual duration of a day has not always been exactly 24 hours throughout the Earth’s history or in different cultural and historical contexts.

References:

How on Earth? Terrence McCarthy (2009)

www.earthscope.org

www.livescience.com/planet-earth

www.inverse.com/science

www.quora.com

www.scientificamerican.com