Titanfall has two campaigns, one for each faction, the IMC Campaign and the Militia Campaign. Is there anyway to choose your faction before matchmaking? It it helps, I've completed both campaigns.
You obviously can't (at least I haven't found any selection mechanism so far).
Basically, the first playthrough you'll be matched into one of the teams randomly (or based on some unknown formula). The second playthrough you'll be matched with the other team you're still missing completion. From then on you're matched wherever there is some room.
It's far from being perfect, but given the nature of the campaign and how the "unlocks" work (order of unlocked titan hulls is the same, no matter which faction you've played first), I'd consider it sufficient.