Does the harmonic minor have something to do with harmony, and does the melodic minor have something to do with melody? I searched this question on Google and nothing came up.
Yes the harmonic and melodic scales are named for their relationship to the melody and harmony. To see why this is, let's first look at the A natural minor scale first:
A B C D E F G A
From a harmonic perspective using this scale, we can naturally build the triads Am, B°, C, Dm, Em, F, and G. These chords are all built in the key; however in traditional tonal harmony we typically will use the leading tone (the note a semitone below the tonic) to establish the key.
In A minor, that note is G# which is not in the natural minor scale, so for harmony's sake we slightly modify the scale as follows:
A B C D E F G# A ("A harmonic minor")
Using this we can now we can get the E major chord and a G#° if we wanted to and use it to help establish the key we are in. When we modify just the G however we now have an augmented 2nd interval between the F and G# and we typically avoid this interval when writing melodies because it is awkward and while it is a second it sounds like a third. To fix this, whenever we go from E up to A stepwise melodically, we use an F# too. But when going from A down to E by step melodically, we usually use G natural and F natural. So the melodic minor scale is as follows:
A B C D E F# G# A ("Ascending A melodic minor") A G F E D C B A ("Descending A melodic minor")
So in conclusion, the harmonic minor scale is used to give us access to the dominant chords typically used to establish the key, and the melodic minor scale is used to smooth out the melody when the 6th and 7th degrees of the scale are used.
Yes think about when do you use the melodic minor form. You use when you go step wise up from the sixth and seven tone degrees of a minor scale. Something that would usually happen if you are writing a line of notes that would simulate a melody.
Wikipedia mentions the following about the harmonic minor's name.
The scale is so named because it is a common foundation for harmonies (chords) used in a minor key. For example, in the key of A-minor, the V chord (the triad built on the note E) is normally a minor triad, which includes the seventh degree of the A-minor scale: G♮, as opposed to the raised seventh G♯, which would make a major triad in Harmonic Minor.