Vent/drain pipes above ground can be joined with no-hub connectors. THese are neoprene rubber sleeves with metal reinforcement bands and all secured with hose clamps. If the fitting was just a thick rubber sleeve with clamps at the end, it is not to code.
Air doesn't really care about the corners, but jogging it over will make it impossible to run a snake down if it ever got clogged by say a dead bird, mouse, squirrel, leaves, etc. Any horizontal sections need some slope so any condensation, melted snow, rain, etc., can drain without blocking the pipe.
What you saw is one reason why many medicine cabinets are surface-mounted, or the wall is bumped out.