I have to switch quite often between 2 SIM cards on my iPhone. I always used to turn it off to do that, however, it seems to work just fine even if I leave it on. Can it harm my iPhone or SIM card or the data on in any way by not turning it off during the procedure?
No, this will not harm your device or SIM card. Although Apple mentions it in their manual and theoretically you can short-circuit your device (I have no clue how, but theoretically...), in practice, when done with common sense, this should not harm your device. You do need to be careful with static charges and dust.
When I went to Italy back in March I purchased a SIM card upon arrival as the cost per minute was a little less expensive than my home network. The agent popped the card right out and put a new one in all while the phone was powered on and there was no problem at all. Even so I'm more comfortable powering it off to replace the SIM card and did that when I got back to the US.