An interesting question was posed to us recently, "Is it ok to put a nail in a tree?" The answer to that question is, for the most part, yes, you can!
Trees are a rather durable plant. Humans have even been known to chop them down and build structures with them, so they are tough! So while putting a nail into a live tree would cause a wound to the tree, in most cases, the damage to the tree is insignificant. The tree will not grow anywhere the nail is, staying right where it is. However, the tree will start to grow around the nail, eventually engulfing the nail within the tree. This can be an issue in the future, perhaps if a chainsaw comes in contact with the nail unknowingly, but the tree itself should be fine.
To lessen the impact of any injury to a tree from hammering a nail into it, we recommend using only galvanized nails and screws that won't create rust and would be the best for the health of the tree. However, it is important to not tie rope or wire around the trunk of a tree as that can kill a tree.