The language pack list is read in real time over the web from moodle.org, using cURL. If this server is not able to access moodle.org for some reason - it is LAN only or off the net or a port is closed due to firewall issues, etc - then it won't work.
The other possible source of trouble could be the permissions to the local moodle data directories, in moodledata/lang, since this is where the language packs list is stored when downloaded.
If you need to, for instance, your server is on a LAN and has no outside outside access, you can download the language packs directly. See https://download.moodle.org/langpack/3.1/ for details.