How can wifi be turned off/on programmatically and do is rooted or system app required for this.
WIFI_ON is a secure setting; only apps signed by the system firmware will be able to hold the proper permission and adjust it using the SDK.
UPDATE
setWifiEnabled() probably supports this, as was pointed out in the comments. I don't see evidence of a permission being required, but if there is one, you'll get a stack trace that should point out what's needed. My apologies for forgetting about this path.