Loyalty is a desirable trait, it implies consistency and dependability. We can be loyal to a cause, an organization, and even a person. Allegiance has the connotation of taking a side. To pledge allegiance to something, say a flag, means you will stand up for it, defend it, even fight those who oppose it.
Be careful what and who you ally yourself with, but more importantly, consider who or what that allegiance might pit you against. Are you ready to be against someone? Should you be? To stand with someone can sometimes mean standing in opposition to someone else.
Consider all sides before choosing one, and if it's not necessary to choose, consider that as well. Do not throw your commitment at the first thing that comes your way. Seek out truths, learn the narrative surrounding a situation, and think of the repercussions of choosing either side. Many times those on the wrong side of history did not think it wrong at the outset.