To Use State Abbreviations : Gravity Forms, you will not just need the excellent Gravity Forms Plugin for WordPress, but you will also need a Commercial License to allow the code below to work.
The code is added to a proper Child Theme Functions.php file. If you are not using a Child Theme, I suggest you set one up first. Edits to Parent Theme’s are lost on Theme Updates. (That means if you need to update your theme, you will have to redo this work, so a Child Theme is always advised.)