This is a modelling question. One plausible model might be as follows. Each player as a strength, which is a real number. The strength of a team is the sum of the strengths of the players on the team. If team A plays team B, then team A will win with probability $f(s_A - s_B)$, where $f$ is the logistic function, $s_A$ is the strength of team A, and $s_B$ is the strength of team B.
This is an example of a possible model. It might or might not be a good model. But if we assume this model is correct, then it is possible to infer the approximate strength of each player, given the outcomes of a bunch of matches. If $s$ is a vector that describes the strengths of all players, define $L(s)$ to be the likelihood of this vector. In particular, $L(s)$ is formed by computing the product of the likelihood for each match that was played. To compute the likelihood of a match between $A$ and $B$, you use $s$ to calculate the probability $p$ that A wins (assuming $s$ is the correct strength); if A actually won, the likelihood of that outcome is $p$, otherwise it is $1-p$. (I assume there are no ties.) For any particular $s$, you can calculate the likelihood of each match outcome like this, multiply them together, and get $L(s)$. Now, to find the "best fit", you find the vector $s$ that maximizes $L(s)$. This is known as a maximum-likelihood method.
How do you find the vector $s$ that maximizes $L(s)$? Basically, you use some mathematical optimization method, like gradient descent.
If you assume this model is correct, another procedure to find the strengths of the players would be to use logistic regression. However, ultimately this will end up being equivalent to what I articulated above.
Of course, you might find that the model I outlined is not a good model. In that case, your task is to find a better probabilistic model that describes the probability that team A will beat team B, as a function of the strengths of the players. Then, you can use the techniques sketched above to infer the strengths of each player.
Finally, once you have the strength of each player, the probabilistic model will let you evaluate different ways of assigning people to teams and figure out which one is most balanced (where the probability of winning for team A is as close to one-half as possible).
This approach assumes you only take into account who won, but not the score. It would be possible to consider more sophisticated probabilistic models that also try to describe the distribution of scores as a function of the strengths of the players, but this will be more complex. I suggest you stay simple for now.
You could also look at the Elo rating system and research whether there's any way to generalize it to apply to your setting, where each team has multiple players and you want to rate the strength of each individual player.