Time-keeping in the ancient world is often a hodge-podge anyway. With only the Sun, Moon and Stars to go on initially, it was always bound to be. The problem is that the length of a day turns out to vary, the length of a month turns out to vary, and the length of a year isn't set in stone either -- and anyway, none of these really agrees with each other very well. There aren't 12 lunar months in a Solar year, and there are about four or five different "years" you can define, and there aren't a whole number of days in a month or hours in a day... it's just an unholy mess.
Anyway, what you can do (and what was probably done) is say that, "when the Sun rises, and then rises again, the time between those two instants is called 'a day'. We will divide that time in to twenty-four equal parts. We want to measure one of those equal parts." This (or using Noon = highest point the Sun reaches in the course of a day, or sunset) is probably what was done to start with.