In the federal system the prosecutor may arrest and detain a "material witness" (= one whose testimony is essential) if it is shown (before a judge) that "it may become impracticable to secure the presence of the person by subpoena (e.g., they may run away)." If the witness's testimony can be obtained by deposition (out-of-court Q&A's under oath), the witness may be detained thereafter only if further detention is "not necessary to prevent a failure of justice." 18 USC 3144.
State systems are probably the same. Material witnesses are usually detained to prevent flight, or for their own protection.
Everyone here @ MS knows that there IS no case unless the victim speaks out, and that others will be at risk unless the perp is locked up. Peace... and Justice!