How to switch LEDs without using relays
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.