As there are various hardware differences between FortiGate models, there is no way to directly transfer the configuration file from one FortiGate to a different FortiGate without making changes to it. Fortinet Customer Support does not provide support to modify configuration files.
It is recommended that the new device is manually configured 'from scratch' referencing the other device. The configuration can be viewed with "Wordpad".
To directly apply an existing configuration file of one FortiGate to another FortiGate, both units must be the same model number and must be running the same firmware version and build.
To transfer the configuration to a new FortiGate unit running the same FortiOS version and build.
1.  On the existing FortiGate unit, go to System > Status, select Backup and then select Backup System Settings to export the configuration as a file.
2.  Install the new FortiGate unit.  Repeat step 1 to export the configuration.  Be careful not to overwrite the configuration file that is to be transferred.  Record the config-version header value and then delete the file.
3.  Edit the configuration file of the existing FortiGate unit to modify the config-version header to match the one from the new unit.  Change interface names as necessary.
For example, if moving from a FortiGate-300 (using interface "internal" and "external") to a FortiGate-400 (using interface "port1" for internal and "port2" for external), change all references to the internal interface to port1, all references to the external interface to port2, and so on.
Furthermore copy only the "config-version" section of the first line of the config file from the device being copied. In this way upon conversion to the new device the correct "vdom" and "opmode" settings will be applied.
4.  On the new FortiGate unit, go to System > Status, select Restore, and upload the edited config file to the new unit.  The unit restarts automatically.
5.  Test the configuration.