However, once the associated webmail account becomes inactive, will these mails still be accessible in the local Mail app? Or will their content be removed automatically?
It depends.
First, Webmail basically the same thing as your Mail app. It’s just the client that is used to access a mail server. In the case of webmail, it’s a mail client hosted by someone (usually the owner of the mail server) rather than something running on your local computer. One very common one is OWA or Outook Web Access. The Gmail web client is basically the same thing.
Email Server Types
There are two email server types: POP3 and IMAP. The POP (Post Office Protocol) will allow you to download message while retaining a copy on the server whereas IMAP (Internet Mail Access Protocol) is server based and you only temporarily cache the mail locally.
If you are using POP to access your mail, you’ll have it locally. If you are using IMAP and connect to the server after it has disabled/deleted your mailboxes, you will lose all of your cached mail because it would have synchronized those changes.
Backup/Copy Mail to local folders
If you’re using IMAP (most likely you are), then you need to create local folders to which you copy your mail you wish to have access to. Since these local folders are not part of the server, if your mailbox is disabled/deleted, it won’t affect those messages.