There is no rule that prevents you from applying again and trying to get an EM spot. However, there are some logistical issues of which you need to be aware (and address).
1. Getting time to interview. Internship is a job, you can't just ask for a bunch of days off to interview for a new position. If you've matched into a position that is in a large metro area with multiple EM programs local (i.e. NYC), then you'd be able to interview at each program in a single day. But if you're somewhere that travel will be needed, getting all the time off you need to interview may not be possible.
2. Funding - because you've started in IM, you get maximum GME funding for 3 years. If you start again in EM, after 3 total years your funding is less -- about 75% of full funding. Many programs will not care about this. Some might.
3. Not sure what you mean by you've "figured out your visa issue". If you need a visa, you need a visa. If you marry a US citizen you might be able to get an EAD -- but this is very complicated.
4. If you applied this year and didn't get an EM spot, being enrolled in a new program won't probably change your application competitiveness. If you never applied for EM the first time, then this isn't an issue (but you'd want to compare your stats to the averages).
5. The match is in March. Your program might require a commitment for a pGY-2 before that. You can't do both -- the match requires that you be uncommitted for July. If you don't match, you might lose your PGY-2 spot and then have to hunt around to find a new one. Your program might be willing to hold your spot open until match results are available, but this is completely at their discretion. Waiting until March to fill a PGY-2 position is a hard ask for a program -- most of the good candidates will have found spots by then.