I bought a Galaxy S5 (G900F- International Model) two years ago. It was locked by carrier. I can't use any network sim from my country. So I spend some money to unlock the carrier (Country Unlock - This is what we name it). It was&is on Android Kitkat. Now I planned to upgrade it to latest marshmallow from official update using Odin and it's files. I just want to know Will it lock the carrier again?
It will not "relock" even if you use the carrier's specific update procedure and firmware. The status of your carrier lock is not stored in an area of the phone that is modified by flashing a ROM. It is similar to your serial number, MAC address, or IMEI number and is (sort of) protected from change.
You can safely upgrade, or consider a custom ROM without worry about losing your carrier unlock.