You should wait until your baby is old enough to roll over or crawl before putting their crib mattress on the floor. This can help prevent them from getting trapped between a gap in the bed and a hard surface, which could pose a suffocation risk if you aren't supervising closely.
Many parents find that it can be a good idea to put the crib mattress on the floor when their baby is between six and nine months old. This allows them time to adjust to the new sleeping environment before transitioning them out of the crib altogether!