Companies with large turnovers (above Rs 50 crore - 6$ million) are mandated to have a route to accept digital payments
https://incometaxindia.gov.in/communications/circular/circul...
Besides this, stakeholders/partners of the NPCI are mandated to offer UPI services. I'm not sure if signing up was optional, but it would honestly be suicidal for a bank not to, given that there are so many competitors offering the same.