The initial activation of two-factor authentication can only take place via an iOS device. Apple wants to make sure that an Apple ID user also has an Apple device.
In general, the procedure for the devices is as follows - based on the Apple instructions:
To step 1 of the Apple instructions:
According to the Apple homepage, you can use the following devices for the initial activation: iPhone, an iPad or an iPod touch with iOS 9 and newer or a Mac with OS X El Capitan and newer. (https://support.apple.com/en-gb/HT204915 - under Trusted Devices).
To step 2 of the Apple instructions:
After activating the Apple ID, a code is sent to the stored phone number for the login, which is then entered on the device. The phone number does not have to be stored on any Apple device.
After that, the phone with the stored phone number is only needed to enter the confirmation code each time you log in to the Apple account.