First, you need your program's approval. It's up to them if this makes curricular sense for you, and whether the rotation will count towards your training.
Then, you need your institution's approval. When you leave the institution, all Medicare funding stops. But they have to keep paying your salary. So it's a loss to them.
Then, you need the accepting institution's approval. Who is going to cover your medmal? Your home institution may not be willing to cover you in a distant state, and this also can create the situation where two different insurance companies are invovled (and then they try to blame each other). You'll need credentialing at that site, which they may be unwilling to do for a short rotation.
You will of course need the visiting program's approval.
Then, you'll need a state license. Some states have training licenses, but visiting residents don't always qualify for them, as the visiting institution may have to sponsor you -- and they might not be willing to do that without a full background check, drug testing, etc. All expensive for a non-employee. Don't count on either program being excited to pay for any of this.
And of course you'll need orientation at the visiting program. EMR training. etc. That usually is only offered once per month, and can last a week. Your home program shouldn't count that as training time.
And then what's the point of all this? If you're trying to explore a field / specialty that your home program doesn't have, it can be helpful. If you're trying to match into a fellowship and think this will help you, don't forget it's hard to look good when you don't know the system / EMR at all.
So, basically, it's a piece of cake.