You have to:
- Move all apps installed on the SD card to Internal Storage (if any). You can do that in Settings / Storage / SD card / Apps. You have to move each app individually.
- Migrate your data from the SD card to Internal Storage (only if you migrated your data to the SD card before). In Settings / Storage / Internal Storage, open the 3-dot-menu and select Migrate data.
- Now your SD card should be empty. If you want to remove it permanently you should format it as portable storage before ejecting it.