In Ancient Greek, vowels could be long or short.
ε ο were always short e o, η ω were always long ē ō, and α ι υ could be long ā ī ȳ or short a i y (Greek didn't have separate letters for the long and short versions).
In Ancient Greek, the accent could be on the third syllable from the end (antepenult) only if the last syllable was short.
This means that τέταρτος is fine (short ο in the last syllable) but the feminine form has to be τετάρτη (since η is long, the accent shifts to the penult, the second syllable from the end).
Also, -ρα was used instead of -ρη for feminine nouns or adjectives -- thus, you have δευτέρα for "second" instead of δευτέρη. This feminine -α is long -- as opposed to, say, the neuter plural -α which is short, so "the second things" would be τα δεύτερα πράγματα.
Modern Greek simplified this quite a bit.
Stress shifting still happens on many nouns (for example, ο κύριος but του κυρίου with the stress shifting since the final syllable was originally a diphthong ου, which counts as long), but adjectives always keep the original stress.
Thus κύριος as an adjective meaning "main" would not shift the stress in the genitive, e.g. του κύριου ονόματος "of the main name".
Nor does modern Greek do this shift of -ρη to -ρα: the feminine form of an adjective in -ος is simply in -η.
Thus modern Greek has δεύτερος, δεύτερη, δεύτερο and τέταρτος, τέταρτη, τέταρτο for the adjective.
But the nouns referring to the days of the week have kept the archaic forms with changed vowels and stress.
(Another example of the simplification is η δύναμη "the strength", which would be completely impossible in Ancient Greek since it has the stress three from the end but with a long vowel in the last syllable. The Ancient Greek form was η δύναμις with a short vowel in the last syllable, which was fine; but these -ις words were regularised and now act like -η words: η δύναμη, της δύναμης, τη δύναμη instead of η δύναμις, της δυνάμεως, την δύναμιν.)