Late to the party, but I came up with a way to accomplish this on a device without root.
It may not be pretty, but it works.
Basically what I propose is to create an app that joins an access point based on EXTRAS given when starting the app.
The EXTRAS are then provided using the am command’s -e <KEY> <VALUE> parameter.
I already build an app which does so and it’s available here: https://github.com/steinwurf/adb-join-wifi
Once the app is installed, a wifi access point can be joined using the following ADB command:
adb shell am start -n com.steinwurf.adbjoinwifi/com.steinwurf.adbjoinwifi.MainActivity -e ssid [SSID] -e password_type [PASSWORD_TYPE] -e password [WIFI PASSWORD]
There’s more info in the README on Github.
Hope it helps someone.