We know that before the story of ASOIAF begins, Robert's Rebellion has toppled the Targaryen Dynasty and crowned Robert of House Baratheon to sit on the Iron Throne.
Stannis is described (more so in the books than in the tv-series) as having a strong sense of justice. He even killed his younger brother Renly because he felt it was just and right for himself to become king over his younger brother. It also goes to show family loyalty isn't high on his values but more likely, he sees family loyalty as a just and right thing to do, unless there is a more just and right thing.
So my question is Why did Stannis join the rebellion?
Should he not have sided with the Targaryen because they were the rightful rulers of Westeros? Even if he believed what Aerys II Targaryen (the Mad King) did to trigger the Rebellion was unjust, would he not have still supported Prince Rhaegar? Or is it more important to stay loyal to his elder brother?