According to Gen 43:2 and Gen 43:10, after returning from Egypt, the time taken before setting off back to Egypt was enough to go and return twice. If we take this literally, then from leaving Shim'on in prison to returning to get Shim'on out of prison was the time of three journeys (return to Cana'an, there-and-back x 2, travel to Egypt).
For estimation purposes, I will assume that Yosef lived in On (= Heliopolis ≈ Cairo) and that Ya'akov and his family were in Ḥevron; this gives a travel distance of about 280 miles (you can check that here, assuming that they have to go along the coast for water, cf. travel in the Roman empire). Camel caravans apparently travel between 10 and 25 miles per day, so let's average that to 17.5 miles per day. This gives us a 16 day travel time. If you wish, bump this up to 18 days to include resting on Shabbat, and you have your travel time one-way.
Since we're interested in six one-way trips, we consider 6 x 16 (or 6 x 18) to get 96 days (or 108 days). Thus, Shim'on would have been imprisoned for somewhere between 3 and 4 months. If we instead take Yehuda's words in Gen 43 as hyperbole, then the real number should be less than this.
Out of interest, at the slowest rate of travel, he would have been imprisoned for as long as 5.5 months (or 6.4 months, if they rested on Shabbat). At the fastest rate of travel, he would have been imprisoned for as little as 2.3 months (or 2.6 months with resting for Shabbat).