Almost always it is the origin of a phrase or saying that requires the most research; the meaning being well understood. This phrase is interesting because there are various interpretations of its meaning.
Firstly, is it 'a friend in need is a friend indeed' or 'a friend in need is a friend in deed'? Secondly, is it 'a friend (when you are) in need' or 'a friend (who is) in need'? If the former, then the phrase means: 'someone who helps you when you are in need is a true friend'. If the latter, it is 'someone who needs your help becomes especially friendly in order to obtain it'.
So, that gives us four options:
1. A friend, (when you are) in need, is indeed a true friend. ('indeed')
2. A friend, (when you are) in need, is someone who is prepared to act to show it ('in deed')
3. A friend, (who is) in need, is indeed a true friend. ('indeed')
4. A friend, (who is) in need, is someone who is prepared to act to show it ('in deed')
The original meaning can be resolved to some degree by the documentary evidence - see below. Nevertheless, there is no unambiguous right or wrong here and this is a phrase that we probably infer the meaning of from context when we first hear it. Whichever of the above options we initially opt for will cement our understanding of the phrase; probably forever, if the vehemence of the mutually contradictory mails I get on this subject are anything to go by.
Origin
A version of this proverb was known by the 3rd century BC. Quintus Ennius wrote: 'Amicu certus in re incerta cernitur'. This translates from the Latin as 'a sure friend is known when in difficulty'.
The Oxford Dictionary of Quotations lists it as existing in English from the 11th century. The earliest version I can find is from Caxton's Sonnes of Aymon, 1489:
"It is sayd, that at the nede the frende is knowen."
The morality play Everyman also contains similar lines. The play's date is uncertain and scholars place it as 'late 15th century', which could be before Caxton's work:
Fellowship: Sir, I say as I will do in deed.
Everyman: Then be you a good friend at need;
By the 16th century, when the proverb was recorded in John Heywood's A Dialogue Conteynyng Prouerbes and Epigrammes, 1562:
Prove [that is, test] thy friend ere [before] thou have need; but, in-deed
A friend is never known till a man have need.
Before I had need, my most present foes
Seemed my most friends; but thus the world goes
So, what does that evidence indicate in terms of original meaning? Ennius' text is ambiguous and, being a later translation, can't be considered the original source of the phrase in English. Caxton's version is also unhelpful. The Everyman play is clearer in its intent and supports interpretation 2. Heywood's verse can't be considered the original meaning as the other citations predate it. It is worth considering though as Heywood was an indefatigable recorder of proverbs as understood in England in the 16th century. It is safe to say that, whatever view we have now, in 1562 either 1 or 2 was the accepted meaning.
Neither 3 nor 4 appears to be supported by early texts and, as they aren't widely held today either, it seems safe to discount them. On the balance of evidence, interpretation 2 has the best claim to be the original meaning of the phrase, that is, 'a friend, when you are in need, is someone who is prepared to prove their friendship by their deeds' .
A search of web-based material shows that 'a friend in need is a friend indeed' has about twice the public currency as 'a friend in need is a friend in deed'. Those who stand up for the latter are probably correct, but they will have a hard time changing the mind of the 'indeed' contingent.