Yes, but with 2 conditions:
First that Shiny Legendaries can't go to Gyms.
Shiny versions are no different Pokémon. So if there's already a regular version of a particular Pokémon in the Gym, you can't add its shiny version.