Could I use "Ich mag mit meinen Mitschülern sein" instead of "Ich unternehme gerne was mit meinen Mitschülern zusammen"? They both sound the same and seem grammatically correct. And the first sentence seems more easy to say.
Ich mag mit meinen Mitschülern sein
is definitely unusual, maybe even considered wrong, but at least antiquated.
There are several ways to express this in a more idiomatic way
Ich mag es, bei meinen Mitschülern zu sein
Ich mag es, mit meinen Mitschülern zusammen zu sein
Ich mag mit meinen Mitschülern sein.
I like to be with my classmates.
This is at least very unusual and maybe some people also would say it's wrong. This is because you used the wrong preposition. If you use another preposition, it becomes a perfectly correct sentence:
Ich mag bei meinen Mitschülern sein.
I like to be close to my classmates.
In German the phrase "mit jemandem" ("with someone") and the verb "sein" ("to be") do not really fit together very well. "Bei jemandem" ("close to someone") fits much better to "sein".
You use "mit jemandem" to describe that people are doing something together, so, they perform an action together, and something is changing.
Tom wandert gerne mit Lisa. - Tom enjoys hiking with Lisa. (Their location changes.)
Ich koche gerne mit meiner Frau. - I like cooking with my wife. (Ingredients turn into food.)
Erich isst gerne mit seinen Kollegen. - Erich enjoys eating with his colleagues. (Hungry people get full.)
But if you just "are" you don't perform anything. Nothing is changing. "To be" is nothing that you can perform together, and nothing is changing. So, in German "being" does not fit with the preposition "mit", because German "mit" and English "with" have not the exactly same meaning. The German "mit" always means that you do something together, like in a team, and when you do something "mit" another person, this doing always goes hand in hand with some changes.
If you want to use "to be" then it is much better not to use the teamwork-preposition "mit" but the local-closeness-preposition "bei":
Ich bin gerne bei dir. - I like being close to you.
I know that in better English you would say "I like being with you", but German works different.