Natural splines are constructed by dividing the range of data into intervals using knots. Within each interval, a polynomial function is fitted, and these functions are joined together smoothly at the knots. The linear constraint at the boundaries ensures that the spline does not exhibit unrealistic behavior at the data's edges, which is a common issue in extrapolation.