The answer is already present in the page whose link you posted:
From Technical Report TR-06-11, "B. Communication and Sensing", pg. 4
During any communication between robots, the receiving
robot also measures the intensity of the incoming infrared
light. This incoming light intensity is a monotonically de-
creasing function of the distance between the transmitter and
the receiver; therefore the distance to the transmitter can be
calculated by the receiver. In practice, the incoming intensity
of light is also affected by noise and manufacturing variances,
which leads to sensing accuracy of ±2 mm, and precision
under 1 mm.
(emphasis mine)
I suppose they experimentally found the relation between distance between Tx/Rx and received intensity (or have access to some characteristic graph from the manufacturer of the IR modules), and used that to base the distance calculations.
It can easily be done with just a transistor, like this:

If your LEDs are common indicator LEDs (which the 20 mA suggests) they may drop for instance 2 V. Then 12 of them in series is 24 V, the remaining 24 V will be across the series resistor R. For 20 mA R can be calculated as
\$ R = \dfrac{V_+ - V_{LEDs}}{20 mA} = \dfrac{48 V - 24 V}{20 mA} = 1.2 k\Omega \$
A simple solution like this has the disadvantage that it's not efficient because the supply voltage doesn't match the required 24 V. You'll lose half of the total 1 W, i.e. 500 mW in the series resistor, so take a 1 W type for that.
Also make sure your transistor has a high enough \$V_{CE}\$ specified. The BC546B can have 65 V, so that's OK, and it also has an \$h_{FE}\$ of minimum 200, so you won't need too much base current.
If you're vexed by the low 50 % efficiency then there's a solution for this, but you'll need more than a transistor. A switching LED driver can very efficiently take care of the 24 V difference between power supply and LED voltage.

The LED driver doesn't require many external parts, but it isn't cheap. This one is the cheapest I found at Digikey and it's 2.50 dollar in 1s. But it has a great efficiency of up to 95 %, which means you lose only 25 mW instead of 500 mW.
Best Answer
Simple, silicon devices are very sensitive to infrared light. See the wikipedia article on a photodiode, there's a graph showing that silicon photodiodes are most sensitive around 900 nm, and that is near infrared light.
Silicon devices are sensitive to visible light so the package has to block all the light.