If the wire was bent into a rectangle with dimensions 5 and 7, the perimeter of this rectangle corresponds to the length of the wire:
[tex]\begin{gathered} \text{Perimeter}=2\cdot5+2\cdot7 \\ \text{Perimeter}=10+14 \\ \text{Perimeter}=24 \end{gathered}[/tex]So if we use the same wire to make a square with side equal x, the perimeter of this square is 4x, so:
[tex]\begin{gathered} \text{Perimeter}=4x \\ 24=4x \\ x=\frac{24}{4} \\ x=6 \end{gathered}[/tex]So the side of the square is 6 units, therefore the correct option is B.