At this age -- for both of them -- time outs are not going to be an effective strategy. Taking a break from each other can allow each child to shift gears, but punitive timeouts require an ability to remember what you did and to then reflect on that abstractly -- and children do not typically have that ability until MUCH later. Time outs tend to work with preschoolers because they give the child a break from the pressure cooker and the strong emotions in a conflict. Time outs work with older kids IF the child is reflective about it. Time outs can seriously backfire, though, and they rarely really solve a problem.
Saying firmly but without anger "No. Hitting hurts. We do not hit." and moving the children apart is a good strategy for now. Keep the talk simple and memorable - things like, No hitting. Hitting hurts. We keep our friends safe. Hands are for hugging. Or hands are for holding.
You will have to repeat this about 25,000 times before they are old enough and capable enough to remember it AND also exercise self-control enough not to hit each other impulsively. But you can do it! Just patiently repeat the phrase, move them away, and move on.
If someone is crying because they've been injured, you can add in having the other child look at the injured one (the 10 month old is young for this, but the nearly-2-year old can do it) -- notice how he's showing that he didn't like to be hit (face, tears, etc.). Rather than let the hitt-er be the "bad guy" - encourage him to help the other child feel better by getting a loved toy, an ice pack, or even just giving a gentle touch or a kiss.
DO NOT HIT EITHER OF THEM BACK - that only shows that you can hit because you're bigger/stronger/more powerful. If you want to explain in concrete terms how hitting hurts, wait until the 10 month old hits him and then talk about how it feels "That really hurt. When So&so hit you, it hurt your arm! When you hit someone it hurts them. We don't hit."
Bear in mind that many many many times when very young children such as these two hit, they are actually just trying to make social contact -- but they have NO idea that their hand hurts the other person, and they haven't yet got the words or the skills to initiate play together. In that case you need to patiently model for them some acceptable ways. The 2 year old can begin to use words, "Want to play?" "Play with me!" and such. The baby of course cannot, but you can be there to help.
In any case you probably need to be physically very close to them so that you can anticipate hits before they happen and redirect or intervene to prevent some of the hitting.
GOOD LUCK!