I want to remove that option so that it does not block invalid URLs
anymore.
Fortinet actually has a clear article on exactly this issue.
it's a checkbox that I can check or uncheck
The checkbox simply controls:
Enable to block web sites whose SSL certificate's CN
field does not contain a valid domain name.
and as they point out:
When a visited URL that contains a "_", the site will be blocked
with "block-invalid-url".
As per RFC 952, " A "name" (Net, Host, Gateway, or Domain name)
is a text string up to 24 characters drawn from the alphabet (A-Z),
digits (0-9), minus sign (-), and period (.).
The prohibition upon having underscores in domain names, which dates back to RFC 952, is a controversial issue which is somewhat pedantically clung to by security software. There's some discussion of it in this answer. In practice, having underscores in the host portion of a domain name is technically not legal, but widely practiced and does not indicate anything at all as to the security of the site.
What is the danger of disabling the check from the firewall for
invalid URLs?
Very low. This is a pedantic check on RFC compliance rather than a reflection upon any actual security value. In practice, malicious sites are not particularly likely to have "invalid" domain names. There is no indication from the Fortinet KB article that they are drawing on any other source of data (e.g., blacklists, keywords) when determining if a URL is "bad".