I recommend setting up the 4.5G as others have said. Take old filter media, a sack of substrate (or fill the bottom with substrate from the old tank) and if you have any logs/plants you can move into the small tank it would be good. The more you move over there, the quicker the cycling will happen. Anything you move will also have the biofilm that the babies will need to feed. That said it will still happen, and stress the shrimp. You might lose this round of babies, but if you get that 4.5G cycled, you can move some shrimp into it and breed some over there.
Also be sure you are careful about your filter selection. Most filters are baby shrimp blenders. A sponge filter is a great one for a small tank like that. If you have a HOB style, you at least need to buy the sponge cover for the intake.
38G: AquaClear70: Planted, 1 Angel, 6 Tetras, 1 Platy, 1 Bristlenose Pleco.
5G Fluval Spec V: Built-in filter, Heavily planted, RCS and Tangerine Tiger Shrimp