Barrier is a skill that is unlockable by an Adept, Sentinel, or Vanguard Shepard as well as Liara, Kaiden, and Wrex.
You do NOT need a target to unlock this achievement. During gameplay you can cast it whenever it recharges. You can also make a save then cast barrier then reload your save and cast it again and repeat until you hit 25. Reloading is way quicker than waiting.
When your team mates cast Barrier it counts toward the 25.