TL;DR: Costa Rica has no threatening armies around it, so they don't need one.
https://www.reddit.com/r/explainlikeimfive/comments/2ycu1f/c...There's also a bit about Panama being chill (possibly because of all the business generated by the canal), and Nicaragua basically held in place by international law.