The metadata file basically provides you with information about your client. Such as entityID, credentials, etc. If it's an IdP, then it also contains a couple of URLs so you know where to send another request, for example. login request, attribute request request. You need to provide this metadata to your SAML component so that it knows who it should talk to.
Another primary goal is to establish a trust relationship between SP and IdP.
source share