The idea that false friends will flake and true friends will reveal themselves as such in times of adversity is ancient; Ennius (circa 239–169 BCE) observed amicus certus in re incerta cernitur (“a sure friend is known in unsure times”), and Euripides observed in his Hecuba (424 BCE) that ἐν τοῖς κακοῖς γὰρ ἁγαθοὶ σαφέστατοι φίλοι: τὰ χρηστὰ δ᾽ αὔθ᾽ ἕκαστ᾽ ἔχει φίλους (en tois kakois gar hagathoi saphestatoi philoi: ta khrēsta d᾽ auth᾽ hekast᾽ ekhei philous, “it is in trouble's hour that the good most clearly show their friendship; though prosperity by itself in every case finds friends”).
A friend in need is a friend indeed
The idiom "A friend in need is a friend indeed" goes back centuries. The meaning of it can vary, depending upon what emphasis you put on the words. For example, is the word "indeed" or "in deed?" "Indeed" seems to just emphasize the "friend" part of the phrase. However, by saying "in deed," as in performing acts of friendship, the expression takes on a clearer meaning. In that context, the phrase means that a real friend is one who helps another who needs him.
An example of "A friend in need is a friend indeed" is when a friend goes out of his/her way to do a favor for someone who is having a family emergency.