To publish an app in the app store, you need to accept various agreements. Unfortunately they are spread around Apple's websites, so please go through all of the steps below to make sure you have accepted all necessary agreements.
Apple Developer Program License Agreement
Open the Apple Developer page.Check if you see the below banner or some other message prompting you to accept the latest license agreements.

If you see something like that, accept the agreements.
Free/Paid Apps Agreement
Open the App Store Connect page for agreements.Make sure you are on the "Agreements" page, not "Tax" or one of the other ones.
If possible, agree to or renew the agreement for free apps. If your app won't be free to download, make sure you also accept the agreement for paid apps, which might require setting up tax and banking information.

