Can a gym get free without battling?
I wonder if a gym can get free after some time (like e.G. 2,3,4,..,n days no action) or by removing defending pokemons (i guess that is not possible but i am not sure?) or other circumstances, or only through winning battles against the defending pokemons? Or will the gym be captured forever if noone tries to lower reputation by attacking?
The only way to remove Pokemon and in turn a team from a gym is by lowering the Prestige of the gym down to zero. Every time you defeat a single Pokemon in the gym, it lowers the prestige by a little bit, with a bonus for defeating every Pokemon in the gym.
To answer your second question, yes, a gym can theoretically be held forever by a single team if no one decides to fight it.