That's a very strange question, because rhythm is one of the three components of music: Melody, harmony, and rhythm.
I would guess rhythm came first, then melody, then harmony, but there are archaic forms like Gregorian chants, which are comprised of melody and harmony but no discernable rhythm.