The 'elements' means the weather - rain, wind, snow etc. If rain can get into a small hole in your roof, for example, it will do some damage and this will only get worse and do even more damage. So 'to get a foothold' means to start to do damage that will get even worse.
Another example could be the wind. If there is a small tile loose on the roof, the wind can start to get under it (get a foothold) and make it even looser. Eventually it will fall off.
If you don't regularly paint your door (if it is wooden) the weather will get a foothold and eventually take off old paint and rot the wood underneath.