The 16:9 aspect ratio of iMovie cannot be changed in a normal project. However you can do it with the following workaround.
In iMovie, use the crop controls to rotate the vertical video sideways in the iMovie project. Export it in the sideways orientation to your desk top. Then open it in QuickTimePlayer and rotate it rightside up, and save. You will have a 9:16 video with no black bars on the sides.
Another way to do it is to go to your projects browser screen and do a File/New App Preview. A screen will open that looks just like a normal projects screen, except that it has fewer options, like fewer titles. Put your vertical clip into the time line of the New App Preview and export it to your desktop using the App Preview export option from the export screen. No need to rotate it sideways. It wiil export in 9:16 vertical aspect without black bars.
— Rich