You can grow cucumbers without using a trellis and the cucumbers will grow out onto the ground and spread out but using a trellis when growing cucumbers is recommended.
When you use a trellis for growing cucumbers the trellis will allow the cucumbers to climb up the trellis and stay off the ground which prevents bugs from getting on them and possibly rotting the cucumbers.
I always use a trellis when growing cucumbers in my garden and it works better than growing the cucumbers without a trellis.
Cucumber plants have little tendrils that grab onto wires etc that allows the cucumbers to climb the trellis.