I went to one of my Teams gyms and there were a few slots still open so I clicked on add and I backed out real quick because I wanted to level up my Pokémon a little more. When i did i went to go put it back in but the button had disappeared but there were still two slots open. So I went to another one of my Teams gyms but just like the last gym there were slots open but the add button was no longer there. I understand the whole leveling up thing. But I should be able to add my Pokémon if there are still slots open just like how I was gonna do before I decided to level him up first. I tried restarting the game and my phone in hopes that was the issue but it wasn't. So now none of the gyms that my Team has I can put any Pokémon in even when there's slots open to put them in there which is kinda making me upset considering thats 1/3 of the game...so if someone can explain to me why even though there are open slots why can't I make my Pokémon join them anymore and what can I do to fix the issue? Like I said I was able to join them earlier until I backed out real quick to level my Pokémon CP up a few more digits. Go to go back in not even a minute later and now no gym for my Team will let me join them. Join button is completely gone now.
This happened to me a few days ago. I was with 4 friends and only one space in the gym (we're all in the same team) and only one of us could put a pokemon in the gym. It turned out to be, that the game I think has a bug that only enables the first person who entered the gym to add pokemon and so on.
A gym, when totally defeated, never loses its initial level. If you and a team of 3 took down a level 2 gym, then only 2 Pokémon could go into that gym until you guys level it more. Similarly, if you and 2 friends took down a level 5 gym, you could put three Pokémon on it. Though the gym only shows one empty spot, it actually has 2 more open until other team members fill it or a rival team takes it down.
Edit: Source: Personal experience.