When can I claim pokecoins? [duplicate]
If it's been over 21 hours since you last claimed the reward you can claim the next reward immediately after adding a Pokémon to a gym. So you could add one and right away get your 10 coins and 500 stardust.
There is no required timer for holding a gym. If you collect, though, you won't get any new bonuses if you take extra gyms - other than experience. As it stands, in a city at least, you're highly unlikely to ever hold a gym long enough to collect twice without taking the gym again.
So, no, you don't have to hold them for any period of time- the only reason to wait to collect is if you believe you can take additional gyms before you lose that one.