The correct answer is: D. How long did you stay there?
The other options are incorrect because they use the present tense, which is not appropriate for talking about a past event. The present tense is used to talk about things that are happening now or that happen regularly. The past tense is used to talk about things that happened in the past.
In this case, the friend has just come back from a holiday, so it is appropriate to use the past tense. The question "How long did you stay there?" is a natural way to ask how long the friend was on holiday.
The other options are not natural ways to ask this question. The question "How long does he stay there?" is grammatically correct, but it is not a common way to ask this question. The question "How long do you stay there?" is grammatically incorrect, because the subject and verb do not agree. The question "How long will you stay there?" is grammatically correct, but it is not a natural way to ask this question, because it implies that the friend is still on holiday.