Poland joined NATO in 1999 and the European Union in 2004 .