If you are certain that it's not a load-carrying wall, there's no structural problem. Is it allowed by code? No.
From the 2018
International Residential Code (some version of which all states have adopted):
R602.6 Drilling and notching of studs. Drilling and notching
of studs shall be in accordance with the following:
1. Notching. Any stud in an exterior wall or bearing partition
shall be permitted to be cut or notched to a depth
not exceeding 25 percent of its width. Studs in nonbearing
partitions shall be permitted to be notched to a
depth not to exceed 40 percent of a single stud width.
2. Drilling. Any stud shall be permitted to be bored or
drilled, provided that the diameter of the resulting hole
is not more than 60 percent of the stud width, the edge
of the hole is not more than 5/8 inch (16 mm) to the edge
of the stud, and the hole is not located in the same section
as a cut or notch. Studs located in exterior walls or
bearing partitions drilled over 40 percent and up to 60
percent shall be doubled with not more than two successive
doubled studs bored. See Figures R602.6(1) and
R602.6(2).
The right way to do it would be to open up the wall and frame out a box (like for a window) around where you need the pipe or duct to go through the wall. If it's sheetrock on one or both sides, this would be easy to do. (Admittedly, not as easy as drilling a hole and pushing the duct through.)
If the wall is load-bearing, then the only way to do it is to open it up and frame it like a small window opening. In checking it for load-bearing, in addition to vertical loads you also need to ascertain if that wall/partition is part of the braced wall system for the structure. Within 18 inches of the exterior wall, it might be part of a braced wall.