It does work but you have to ensure the fabric has no wrinkles (but not stretched tight) for coating and printing.
There are several downsides. Photochemicals are not really fabric friendly and the emulsion very soon starts to come off in the wash. But it's OK for a quick one-off you don't want to keep.
It is possible to produce gum bichromate images on t-shirts - and one or two other 'alternate' print methods work too. But again they don't survive the wash too well.
The main drawback of using an enlarger to print onto t-shirts is that you need to put a light sensitive medium on to the fabric first and this produces a fragile surface. Also, a lot of light sensitive media work with UV and enlargers do not produce much, normal glass being only partially transparent to UVA and totally opaque to UVB.
Much better methods exist for printing on t-shirts by means of inkjet printers and photocopiers. These images do not survive the wash either but they are much cheaper, quicker and easier to produce and you can do colour.