A federal judge has blocked US President Donald Trump’s executive order banning transgender people from military service.