In Shadow Puppets, Bean and Petra got married before they became adults, or so it appears. This is never explicitly stated, but Shadow Puppets only takes place a few years after the Formic War, so Bean should still be in his early teens. What were Bean and Petra's ages at the time?
Petra was approximately 3 years older than Ender at the time Ender joined Salamander Army.
Bean is approximately 5 years younger than Ender, as he entered Battle School around the age of 4 and was moved into his army (Ender had been a soldier for 3 years at Battle School when he became the commander of Dragon Army, and he joined when he was 6).
So there is an age gap of around 8 years between Bean and Petra. Bean is probably either 12 or 13 when he marries Petra, who would be 20 or 21. Bear in mind, that with his genetic traits, Bean had already reached physical and mental adulthood. So it wasn't like Petra was robbing the cradle.
This timeline states that Bean was born 6 years before the Third Formic War, and that 8 years after that Peter creates The Free People of Earth government (making Bean 14). Shadow Puppets takes place before that event.
Shadow Puppets states that Bean met his parents for the first time when he was 12, which gives his age at the end of the Ender's Game/Ender's Shadow. Shadow of the Hegemon starts almost directly after, no more than a few month, and the events of which likely happen over no more than 1 year, so we can estimate he was likely 13, by the end of that book. Near the end of Shadow Puppets, Petra reminisces about the "years" that her and her family lived in the Hegemony Compound; therefore at least 2 years of time occur between the end of Shadow of the Hegemon, and the start of Shadow Puppets, so Bean would've been at least 15, almost 16, likely by the time they married, as that's about halfway through the book after they've been on the run for months.
It’s explicitly stated in Shadow of the Giant that Bean was 16 during most of their marriage and when he entered his ship with his three. I’m not sure of the age gap between him and Petra, but she’s of an age with everyone else, so she was maybe 19-21.