Firstly, the project must use iterations/sprints, and also use the iteration/sprint field.
If these criterias are fulfilled, to add the issue to an iteration/sprint is simple - just set the correct iteration/sprint in the iteration/sprint field of your issue.
What if you need to add iteration/sprint to the issue fields? (The following assumes you have access to the relevant setting pages)
To set a project to use iteration/sprint , you need to edit the project info page and check the box 'Use versions'.
To add the iteration/sprint field to the issues, you need to edit issue field configuration for the project in question (possibly creating/copying a new configuration if only a single project needs version). See article here: Customize your issue fields in the Issue Field Configuration
Set the project to use the issue field configuration with the iteration/sprint field. (Project settings - Issue field configuration)