The answer is both yes and no. It depends on the chainsaw.
For example, the Husqvarna 440e comes with a 16-inch bar. Still, you can put an 18-inch bar on it. However, it might not have the power enough to cut with a 20-inch bar and chain.