People break the rules. Fictive characters do it even more.
@Wetcircuit has a good point in his comment to your question, and I want to add to it.
- If your police officer is not the hero, he would house her for his benefit and not hers.
- If your police officer is 'the hero', he should house the child to save her, not to use her.
I imagine a scenario where your officer (like the rest of the police force) realizes that they will get nothing out of her, and have to let her go. Maybe he managed to make her smile once, but, overall, she wasn't useful to the case as a witness.
Later, he comes across the girl in another place. Perhaps he intervenes during a kidnapping, or she's caught up in/witness to something else, and this time, she actually finds comfort in recognizing the police officer. Perhaps, this time she doesn't actually have anyone else (or her parents are part of the crimes or dangerous, perhaps one killed the other...), and though 'his superiors' won't (and can't legally) allow him to let her stay at his place, he risks it for her safety.
He slowly earns her trust when she realizes that he's not there for her because he wants something. Perhaps he shows her care and attention in ways she's never felt before. She slowly learns that "the police" isn't the evil she's been brought up to believe, and perhaps indirectly gets to know some of the police officer's closest friends/pals/colleagues - the police officer tells stories about them.
Act 3; our police officer is critically injured, maybe killed, and to save/avenge him, she comes forward with useful information.
Additional tips for structuring the story
If these are both main characters, I suggest making sure that they both have their own side-stories/sub-plots, where we get to know them and understand how differently they approach the world (seemingly).
Later, they may realize that their differences are merely a matter of perspective and that they actually have the same core values, only shaped and created differently (us vs them, good vs bad, right vs wrong).
Also, focusing on side-stories makes it easier for their relationship to grow at a natural pace. If everything's focused on what happens between them, it will probably happen unrealistically fast, or take way too long to stay interesting.
The police officer: Romance or relation to a friend and sibling or family issues + additional crimes to fight and keeping her a secret.
The girl: Trying to figure out what's in it for the police officer (until she trusts him) + what's her own life actually like? Friends, family, school, hobbies? How does she act/feel about the crime(s)?