M., I think the suggestion of a children's or family counselor is a very good one. I can tell you dearly love your niece, so I want to point out something that I have observed over years of working with children.
We adults have very different views regarding transitions than children have. Children, especially very young ones like your niece, are prone to be very 'present' and in the moment. That is to say, they thrive when we let them be just where they are in the here and now. We prepare them for near-future upcoming transitions ( for example: leaving a favorite spot like the park or a zoo; stopping play and cleaning up one's toys; in short, the usual situations where we give them a five-minute warning.) Kids can generally handle these immediate types of transitions well enough.
In fact, adults are so often told to help our children have smooth transitions that we extend this to areas of life where less information is probably better. An example of this would be a family driving by an elementary school in January and telling their five year old "In September, you'll be going to school here!" The parents mean well, are playing it up as a positive. And for some kids, that really isn't a problem.
But for others, in my direct experience, this is a huge anxiety for the child. It's a big unknown and unlike adults, who have prior experience and cognitive understanding of transitions, the child is left to grapple with this only in their imagination. It's something they have simply never done before. Or perhaps they have a negative association with that situation and so they are projecting their own past experience of a place or situation onto the future with the only information they have.
It is very likely that this little girl is very upset and frightened about this change in her stability and frightened about going back. Which is why she will need some therapeutic help. This is a huge event in her life. Her primary caregiver is going to change. Children's memories can be fuzzy, and it may be that to her, you are the only loving caregiver she has known. Perhaps she remembers the trauma and upset of her father's neglect and her mother's arrest. Perhaps she has memories of her needs not being met.
I would encourage you not to discuss the upcoming custodial change to her without a therapist's assistance. I know that you are likely trying to make this transition sound like a "positive", but her own experiences may not jibe with that. And then there is that confusing feeling of cognitive dissonance: in that she may be very confused that you are saying something is a 'good thing' when she may not have experienced it that way. Who is right? That's a lot for a five year old to ponder.
Anxiety can come out in many forms. It sounds like her deep hurting is a manifestation of her fear and emotional hurt (which, in our lower brain, is processed in the same area/receptors as actual physical hurt). Please, talk to the school counselor and see if you can get some help or an outside referral. Ask for help. This is a lot for you to deal with. Her mom should continue to take her to counseling once she has custody, too. Also, what are your sister's plans? Will your nieces be able to stay in the same schools, with the same support systems? This is something one must seriously consider to keep what stability the girls have in their lives.
tl;dr: find a counselor, stop trying to 'talk up' this transition, and try to let her be in the present as much as possible. Remember that her pain is really based in her fear and hurt and that it's valid, and get mom on board with keeping things as consistent as possible for the kids.