Yes, but virtual DOS session detects that DOS program is trying to communicate to COM port and simulates that.
If Windows simply locked up DOS programs, they would not work. I seen programs written in 1988 working under Win2k and WinXp and happily communicating over COM1.