Mashiloane was a key figure in the Baroka setup, as the versatile player featured in 29 matches across all competitions for the Limpopo club.
The 23-year-old, who can play as a right back and a defensive midfielder as well, was once linked with Sekhukhune United before the just-ended season began, but the deal did not go through.
Mashiloane's move to Pirates adds to the list of players who have crossed Bakgaga to Soweto, with Gift Motupa and Thabiso Kutumela the most notable players to make similar moves.
Meanwhile, Bucs will be keen to secure top-quality players in order to help them challenge for titles.
They failed to beat Mamelodi Sundowns to the league title and have finished second three times in a row, while their Caf Champions League journey ended in the semi-final.