You have to raise your gym's rating up to X level before it can hold X Pokemon. So, if your gym is ranked as a Level 2 gym, and there are 2 Pokemon defending it, you can train at it, adding prestige until it becomes a level 3 gym. When it reaches that point, and you click on the gym, you'll see the normal boxing glove icon for training on the lower right, but there will also be a triangular-ish icon on the left. Click it, and you'll have the option to add any of your fully healthy Pokes as a new defender.
Be careful, because if someone else is training there at the same time, they might try to start a new round of training right after you've pushed the gym up to the next rank, see the Add icon, and add one of theirs before you can.