If all modes derive from a scale which scale were the very first modes derived from? I know the modern modes are derived from the diatonic scale but if the first modes came before the major and minor scale and we got the major minor scale from the modes then what scale did the first modes come from?
There's a little ambiguity in what constitutes the "very first modes." There were ancient scale systems in many ancient cultures, which had structures we might call modes in India, China, etc. But I'm assuming the question is asking where the "Western music" modes come from. And the scale for them really comes from Ancient Greece.
To expand a bit on Albrecht's answer (and as referenced in comments), the ancient Greeks built their scale around intervals of a fourth called tetrachords. The center of their scale was a note called mese, which is generally associated with the A below middle C in the modern scale. (Note that the ancient Greek scales predate all use of letters to refer to notes, so they had no concept of "middle C.")
The note mese served as the basis for building tetrachords. Generally, the Greeks conceptualized building notes downwards, so they would construct a tetrachord from A down to E. (I'm just going to use modern note names, rather than the ancient Greek ones.) There were many different ways to tune the notes between these two endpoints. Generally today an oversimpification of Greek theory is taught that there were three genera (singular genus) of tetrachords -- the diatonic, chromatic, and enharmonic -- but really there were dozens of different possible ways of tuning tetrachords, as discussed in Greek treatises. Some Greek theorists classified these many different tunings for the scale into those three categories, which is why we see this simplification in modern textbooks. (Not many people are concerned with the subtleties of ancient Greek music theory these days.)
In any case, one of the most popular tunings for the tetrachord was a so-called diatonic tuning, which literally means "through (whole) tones." One created that tuning by tuning two whole tones down from the starting note, i.e., A-G-F. After that, the remaining interval was just left to be what it was (about a half step), so you ended up with the tetrachord A-G-F-E.
The next thing you need to know about the source of the scale for modes is that the ancient Greeks allowed tetrachords to be conjunct (sharing an endpoint) or disjunct (usually with a whole tone between endpoints). By using a disjunct tetrachord above the A-E tetrachord mentioned above, you would have a tetrachord moving E-D-C-B, then skipping a whole tone down to the A (again, the A below middle C in a modern scale).
Overall, you now have a scale E-D-C-B-A-G-F-E. Some Greek theorists referred to this as a Dorian scale. (Yes, that's not what it would be called today; we'll get there.) "Dorian" in this case apparently had some connection with the culture of a region in Greece (the Dorians), and it likely didn't just refer to the scale but likely some specific ways of playing notes within that scale as well. And the tuning wasn't necessarily all diatonic either. But one might think of this notion of "Dorian" as corresponding to "mode" of sorts.
We can expand this scale further by introducing a conjunct diatonic tetrachord below, beginning on the low E, giving an overall scale: E-D-C-B-A-G-F-E-D-C-B. The Greeks added one more note on the bottom to represent an open string, i.e., low A at the bottom of the bass clef. (All the other notes would have been played as stopped notes on a string.)
The Greeks also could add a conjunct tetrachord above the note mese, which results in a half step above A, namely the tetrachord D-C-B♭-A. This seemingly was allowed again because mese was a special note at the center of the scale. Another tetrachord was often added at the top of the scale too.
The Greek diatonic scale system was transmitted into Latin by Boethius. The scale was eventually reordered to be thought of as going from lowest note (A) to highest note. At some point, misunderstandings about the Greek idea of tacking on "one more note" on the bottom of the scale caused medieval folks to tack on yet another note, which was called gamma, after the Greek letter Γ (which we now think of as the low G on the bass clef -- originally the lowest note).
This reinterpretation brought about the standard medieval gamut or scale, which was thought as the entire basis of music for several centuries, namely Γ-A-B-C-D-E-F-G-A-B♭-B-C-D-E-F-G-A-(B-C-D-E), beginning at the bottom of the bass clef and terminating in the highest space of the treble. (The highest tetrachord was also frequently tacked on in medieval treatises, even though it was rarely part of ancient Greek scale construction.)
After that, there were several attempts to fit "modes" to this scale over the centuries, which are discussed in a cursory manner in the Wikipedia article linked by Albrecht. Eventually, due to some more mistranslations, the scale that began on D became known as "Dorian" (i.e., D-E-F-G-A-B-C-D). But all the modern modes ultimately were based on this particular diatonic scale expanded on a model from ancient Greece. I believe that's the "source scale" the question is likely referring to.
Lastly, I'd just clarify the notion that the major and minor scales were "later developments." Note that it's true that major and minor scales as they are now understood didn't really exist until maybe the 17th century, partly derived from the Ionian and Aeolian modes added to the medieval modal system around 1500.
However, that doesn't mean no one played music using major or minor scales in earlier times. The ancient Greeks, for example, had a scale that some theorists called Iastian that encompassed the octave from C to C and potentially sounded like "major" if played using diatonic tuning. The earliest medieval modes (called tones) would have classified a melody using what we'd now think of as a C-D-E-F-G-A-B-C scale as a variety of tritus scale. The later medieval modal system would have thought of that scale as a transposed form of a Lydian scale, making use of the B♭ option I mentioned, namely F-G-A-B♭-C-D-E-F. Only later did theorists begin to think it necessary to give this scale its own distinctive name, Ionian, which then developed into the major scale. One could similarly find versions of the "minor scale" all the way back to the ancient Greek scale systems too.
The modes of the middle age church are derived from the antic Greek modes and these are developed from tetrachords, and yes it is something with history ...
Early Greek treatises describe three interrelated concepts that are related to the later, medieval idea of "mode": (1) scales (or "systems"), (2) tonos—pl. tonoi—(the more usual term used in medieval theory for what later came to be called "mode"), and (3) harmonia (harmony)—pl. harmoniai—this third term subsuming the corresponding tonoi but not necessarily the convers. (the Greek modes contained even 1/4 tone steps.
but the modes we use today are similar or better identical with the church modes
same source above)
The major and minor scales are derived from the Ionian mode (Do-ladder) and Aeolian mode (La-ladder)
(same source above)
Concerning the Greek modes we have yet some extensive answers: