In /l/, there's a closure between the sagittal middle of the tongue and the roof of the mouth. Air is released along the sides of the tongue. In /s/, more or less the opposite happens. The sides of the tongue are raised, and a groove is formed along the sagittal middle. If you move the tongue from an /l/ towards an /s/, and you don't time the formation of the groove correctly, you'll form a complete closure between the tongue blade and the roof of the mouth. The sound emerging from that configuration is a /t/.
In short, /t/ is formed as a transition from /l/ to /s/ when the different tongue configurations are not perfectly synced.
As a side note, the reverse happens in Icelandic, where the sequence sl- is pronounced /stl-/.