it seems to be a case of vaso vagal syncope
(syncopal attack), as it some times be precipitated by a posture change, emotional stress and several other factors.
i would like to know if there is a history of similar episode in the past. or is there any family history of similar illness. this kind of symptom also can occur in cases of abdominal migraine
. or some other abdominal organic pathology
for better understanding of the cause you need to consult a pediatrician
to evaluate her with proper history and examination may be she needs some cardiac evaluations like Blood pressure measurement, Ellectrocardiogram, complete blood count
to look for anemia, abdominal USG and other investigation as required. hope i ve answered your query. thank you