The short answer is, sometimes. Many airlines are part of an alliance. There are three major alliances most people are familiar with: Star Alliance, OneWorld and SkyTeam. Each includes one U.S. legacy airline. United is part of Star Alliance, American Airlines is a member of OneWorld and Delta is a SkyTeam carrier.
One perk of alliances is the ability to book reward travel on multiple airlines. For instance, Delta SkyMiles may be used for reward travel on partner airlines within the SkyTeam alliance, such as Air France and KLM. So in this case, yes, you can transfer miles, as long as you’re transferring to an airline within the same alliance.
Another way to transfer miles is to use a travel credit card that is not connected to a specific airline. Some card issuers have their own rewards programs, such as Membership Rewards from American Express or Ultimate Rewards from Chase. Points earned in these programs can be used to book travel directly or can be transferred to a partnering airline. Just be aware that once points are transferred, they can't typically be transferred again to a competitor airline.
Learn more about transferring airline miles between loyalty programs.