The Pesantren Law (UU Pesantren) is a law that regulates the implementation of pesantren in the educational function, da'wah function, and community empowerment function. This law provides recognition, affirmation, and facilitation of the role of pesantren in shaping, establishing, building, and maintaining the Unitary State of the Republic of Indonesia. This study aims to examine the opportunities that pesantren have in facing the era of globalization and the industrial revolution 4.0, as well as the challenges and strategies that need to be done. The method used is a literature study by reviewing various relevant sources. The results showed that pesantren have the opportunity to become superior educational institutions, competitive, and contribute to the benefit of the people. Pesantren can also be agents of social, cultural, and economic change based on Islamic values. However, pesantren also face challenges such as the lack of human resources, facilities and infrastructure, technology adaptation, and curriculum development. Therefore, pesantren need to carry out strategies such as maintaining the characteristics of pesantren, riding on the development of the times, and realising the values of pesantren to the public.