The most important question here is whether the two operating airlines have a baggage interline agreement. Given that all three airlines involved are major airlines that have been around for a while, I'd be very confident that both Copa and Avianca have interline agreements with UA.
That said, my confidence is worth no more than you paid for it, perhaps less. The best way to find out is to ask Copa and Avianca. (I suggest that because it can be hard to get through to anyone at UA who knows anything, though if you do reach such a person he or she could then answer both parts of the question.)