Great question, but such an unfortunate situation for the child. To answer your question directly, there does not necessarily have to be long term damage, provided that she is adequately prepared for the transition - and (if this is possible) eased into it rather than "forcing" it upon her. Obviously, if the non-custodial parent does not like/trust the custodial parent who is trying to ease the transitions, s/he will accuse the custodial of meddling, undermining their authority, etc. But still, the mental health of the girl should be considered.
If the visits are "forced," then the child's stress is going to run away and she will experience the nightmares or acting out behaviors you mentioned. She may regress and act younger than her age (like wetting the bed, throwing tantrums, engaging in "baby talk" at times, etc.). Over time, she will learn to cope with the stress in some form or fashion, and this coping strategy will probably become a permanent part of her unless it is eventually treated (i.e., she may "check out", she may become overly compliant/subservient, she may become angry and defiant - hard to tell at this stage).
If I was her therapist, I would work with the parents to make the transitions less severe and break her into the visits at a pace that she can manage. Maybe have the non custodial parent visit her at home first to have her get to know the other better and feel safe - and also to see that the custodial parent is relaxed around the non-custodial parent and does not react in a way that triggers the girl's sense of danger. Then, maybe have her go with the custodial parent for a visit, and then later for a longer visit, and then have her stay with the non-custodial for over-nights locally, and then move to overnights five states away.
I know we do not live in an ideal world, but she will dig in even harder the more she feels "pushed." I wish you well in resolving this - If you are satisfied with the response, please hit "Accept." That is the only way I can receive credit for my answer. Thanks-