Ed gave up his alchemy, so when Ed and Al lost there bodies (Al's body and Ed's left and right are), he received both his limbs and Al's previous body, Al's body was attached to the armor with a blood seal so Ed sacrificed his left leg and Al's body to bring there mother back to life. Here's where I'm at so after Ed lost his limb and they brought their mother soulless body back, he used his right arm to bound Al's bodyless soul to the armor, at the end of brotherhood Ed gave up his alchemy to bring their bodies back (Ed's arm and leg and Al's body) So how was his soul rebound to Al's original body?
So here's a summary of the timeline/trades:
- Ed trades his leg for their mother. The leg ends up with Truth in the white space outside the gate.
- Al trades his body and soul for their mother. Body and soul end up with Truth in the white space outside the gate (different white space than Ed's).
- Ed trades his arm for Al's soul. Al's soul comes back to the real world. Ed's arm ends up with his leg in the white space.
- Most of the series happens here.
- Ed's automail arm is destroyed. Al trades his soul for Ed's arm (reversing the trade in 3). Al's soul goes back to the white space and merges with his body, Ed's arm comes back to the real world.
- Ed trades his alchemy for the entirety of Al that's still in the white space with Truth: Al's body and soul.
So, Ed never gets his leg back (you can see he still has the automail leg at the end post time skip). Al does a trade himself in 5, which merges his body and soul and gives Ed his arm again, and then Ed brings all of Al back by trading his alchemy.