Adding the Store Code to your URL can be useful if you have a Multi-Language Store Setup and want your customers to know exactly which language version of the store they're currently browsing. For instance, if you have English and French Store-Views, you can display the URLs as:
Showing Store Codes in the URL is quite simple and can be done directly via the Magento Admin configuration. Start by heading into Admin -> Stores -> Configuration -> Web and expanding the URL Options tab. Afterward, uncheck the Use System Value checkbox and change the setting to Yes.
Once you're done, Save the Configuration and flush the Magento Cache from the Cache Management section. Reload the frontend and you should see the Store Code inserted into the URL.
If you're not sure what the Store Code for a particular Store-View is, you can find it by heading into Stores -> Settings -> All Stores and checking the code value underneath the Store/Store-View name: