HSTS restricts the connection to be always HTTPS if deployed by any domain, however for it to be applied to sub-domains the 'includeSubDomain' attribute is needed. Why doesn't the policy itself make it mandatory to include all subdomains? For what reasons/restrictions is the flag asked to be set?
Subdomains can often be used for different purposes, and as a result they can be using different web applications possibly hosted on different equipment.
Not every website on every subdomain needs to follow the policy of the domain, it can even be the case that sites on subdomains do not support HTTPS due to lack of support in the application and/or not having a SSL certificate.
So automatically enforcing a policy on the main domain could possibly break things for subdomains.
It's best to let the site owner decide whether subdomains are affected, just as the site owner decides whether to use HSTS at all. The extra flexibility could help improve HSTS adoption by reducing compatibility obstacles.
Some of the subdomain services may not have an HTTPS server installed yet. There are a few cases where it's not important security-wise to have HTTPS on certain subdomains.
That answers why
includeSubDomain is not mandatory.
One could still ask why it is not the default:
For this I would like to point out that HSTS cannot be undone except by asking your visitors to clear cache in their own browser. Chances are your visitors will not do this.
So, if you accidentally applied HSTS to more than you intended to, that (sub)domain goes down permanently for those visitors until they switch devices or browsers, clear cache on the browser, or the site owner installs an HTTPS server. (which might be technically difficult on some legacy services)
My best example on why this would be bad, is webhosting. Imagine a webhost, lets say somecheapwebhostingexample.com has HSTS and even a payment page. And then they don't have wildcard certificates or anything like that.
Then a customer signs up as customer1.somecheapwebhostingexample.com . Its obvious its a bad example to deploy subdomains per default here.
There are other examples where theres multiple subdomains, but no certificate available for them all.