roundworms are contagious to other dogs but they cannot be passed from dog to dog just by being int he same room. However, if the dogs have defecated in the room and there are traces of the stool on the floor there is a chance that the worms can be passed from dog to dog.
More useful articles on a similar topic 👇
How is whipworm spread in dogs?How do humans get whip worms?