This breaks my heart, and I can't say my son's middle school experience was very different some of the time. I don't think the boys understand what is going on, and it is hard to maintain friendships. Absences really interfere with school social life since so much of it involves which table you are sitting at during lunch, and who your partners are for science class. You can lose those places if you are out for even a week. If you stop playing soccer, it is hard to maintain friendships with the soccer kids. One thing that got my son through those years was music. He continued with that when all the sports were not possible, and that provided an outlet, a community, and a sense of accomplishment. He had a private lesson so the demand wasn't too high, but it was an area of strength and competence. I would try to find something not dependent on physical ability to keep your son involved with an activity.
Middle school is pretty tough socially at the best of times, and I think appearances are deceiving. Some kids who look very well connected feel isolated, and those who appear alone are content. Our family tried very hard to keep my son going during the worst times, planning around his health and giving him opportunities and experiences. It almost sounds cliche, but we took him to see a band he liked, or planned a trip to the city and went to a museum. We brought along cousins and he has siblings, so he was social, just not with his school friends as much. I hate to admit this because I dislike video games, but xbox live was a good way for my son to connect when he was out of school, and he played some games and chatted with friends when he wouldn't have been up for much else. When his health improved, he switched schools and it all worked out.
The last thing we did was find lots of funny things to watch together. There is an endless amount of humor on You Tube, or even a TV series to watch together on Netflix. He would come home from middle school just drained and that helped him to relax, and think about something else. I am smiling just thinking about it. He was probably a bit older, and found a lot of this himself, but honestly laughter helped and we found ways to laugh through a lot of the more depressing experiences (mri, lab, doctors visits, etc...).
I have learned that each phase will eventually pass, and the most important part is getting your son healthy, making sure he feels supported, and not letting the illness define him. We had to be very strong for him, including pushing him forward when I would have loved to protect him. We would act as if things were fine, hoping that they would be. You will probably have a better year in middle school in 7th grade, after this adjustment and with more information on all sides.