My recommendation is similar to the others. Make sure there is no medical reason and then give your older son's accidents as little attention as possible. Instead redirect him by paying more attention to current positive actions. Maybe give him something else to learn since the youngest is learning how to use a toilet. Maybe he can learn how to tie his shoes, make a sandwich, put away the silverware, something chore related.
If you reward your youngest for not having accidents or using the toilet correctly then your oldest may be gunning for those rewards or attention. What ever you do, don't punish for toilet/bathroom/accident stuff. It can create huge issues and becomes a control fight that the child will always win. It's his bowels after all and he can hold them or let go when he likes. Turn it into a fight and you could end up w/ a strategic pooper that likes to "bomb" you in the grocery store, at a party, out at the park, in the car, etc. Or worse he could turn it into "I'm not allowed to go in my pants so I'll go in the corner, on the rug, the couch and such.
So hopefully I didn't scare you but my biggest suggestion is that after making sure it's not medical, drop the issue. Make it no longer a game of action and reward. Have the accident = get the attention. Send him to the bathroom to clean up. He gets to remove his own pants etc. (prepare the bathroom for this - ditch the rugs or have one you don't care about). Put a monster box of wet wipes and a trash can in there and let him deal with it. Go in when he's done and double check the job, but if he's a big boy and is going to school in the fall then you won't be at school to help him when this happens so he needs to learn to deal with it himself. This will quickly become not fun.