Dogs have a natural instinct to mark their territory using urine, and peeing on trees is just one way of fulfilling this instinctual behavior. By urinating in specific locations, they are essentially leaving olfactory messages for other dogs. It helps establish boundaries and communicate important information within their canine community.