Magnetic fields play a role in the dynamics of many astrophysical processes, but they are hard to detect. In a partially ionized plasma, a magnetic field works directly on the ionized medium but not on the neutral medium, which gives rise to a velocity drift between them: ambipolar diffusion. This process is suggested to be important in the process of star formation, but has never been directly observed. We introduce a method that could be used to detect ambipolar diffusion and the magnetic field that gives rise to it, where we exploit the velocity drift between the charged and neutral medium. By using a representative classical model of the collision dynamics, we show that molecular ions partially align themselves when a velocity drift is present between the molecular ion and its main collision partner H2. We demonstrate that ambipolar diffusion potently aligns molecular ions in regions denser than their critical density, which subsequently leads to partially polarized emission from these species. We include a model for HCO+ and show that collisional polarization could be detectable for the ambipolar drifts predicted by numerical simulations of the inner protostellar disk regions. The polarization vectors are aligned perpendicular to the magnetic field direction projected on the plane of the sky.