OK, since that other SE question seems to suggest that Rowling never supplied a canonical answer, we'd just have to settle for a plausible explanation: It's a magical snake and a magical school.
After all, in the Harry Potter universe, things are impossibly squeezed into smaller things all the time. Remember, for example:
- That people enter the Ministry of Magic by flushing themselves down the toilet, passing through pipes which they obviously wouldn't normally fit through:

- That the Knight Bus can contract and somehow squeeze through two oncoming buses in a matter of seconds:

- And that thanks to an Extension Charm, small tents can be huge on the inside and Hermione's tiny handbag can contain a room full of stuff:

It's also worth noting that snakes, which in real life can already squeeze into small holes, may be even more capable of that in Potterverse because Nagini, Voldemort's huge snake, was somehow able to hide inside a small woman. Add that to the fact that Hogwarts Castle is supported by magical architecture and contains moving staircases and a room which could become just about anything, and it's not that hard to imagine that the pipes there were magicked with an Extension Charm or some other mystical means to accommodate volumes way beyond their capacity - perhaps intentionally, by Salazar Slytherin himself, to allow the Basilisk to come out of its hiding.