I think he's going to have to learn this pretty much on his own, but you need to provide opportunities for him. In general, prevention is always the best technique to use. When he sees other children who are already engaged in an activity and wants to join in, try to talk softly to him about what is going on and what he will need to do when he is part of the game. With his little brother, it is a different matter. Help him realize that his brother is too little to defend himself and that he, a big boy, can help.
Try to make certain there is always an adult nearby when he plays with other children. The adult (and you would be the best person) can usually spot a build-up of turmoil or tension likely to lead to trouble. When you spot those moments, distract him and try to get him out of the middle of the situation. Let him go back only after the situation changes.
Our parenting advice is given as suggestions only. We recommend you also consult your healthcare provider, and urge you to contact them immediately if your question is urgent or about a medical condition.