Justices clear way for the transfer of $2.5 billion from the military budget to build a barrier along the border.