My take to this problem is this:
In the case the two teams have the same amount of students. If student A is on team 1 (or 2, it does not matter), then there's 4 slots available for student B. So the probability of B getting that slot is $\frac{4}{9}$. So, the probability of A and B to be in the same team is $\frac{4}{9}$
How do I deal with finding the probability in the case the teams are not even? (2-8, 3-7, 4-6). How can I do this problem using combinations?
Suppose that one team of three students is chosen at random from the class. Two given students A and B are in one team if they go to chosen team or if stay at the rest part of $7$ students. The total number of possibilities to choose $3$ students is $\binom{3}{10}=120$, the number of favorable combinations is $$ \binom{1}{8}+\binom{3}{8}=8+56=64, $$ and the probability is $\frac{64}{120}=\frac{8}{15}$. Here $\binom{1}{8}$ is the number of variants to choose three students with A and B and one extra student chosen from the rest $8$ students. The summand $\binom{3}{8}$ calculates the number of variants to choose $3$ students so that A and B stay in the second team.