Flats (also known as Chicago Mints) is a slang that is heavily used in areas such as Chicago to refer to Ecstasy pills. This term is used to refer to high quality ecstasy pills, and more specifically the small ones, not the chunky ones (E pills come in different sizes). Flats generally have plain markings on them such as an equal sign or just a dot.
This slang has been used in numerous songs by rap artist, especially Drill Rappers from Chicago. In Chief Keef's Macaroni time, he said "Dumb f*ck just popped a flat, I'm beamin' right now", Chief Keef is basically saying he just took a pill and he's really high. In SD's "Can't Tell Me Sh*t" song, Fredo Santana said "I need a pill SD where dem' flats at".
Some people also refer to Xanax pills as flats because they actually look flat. Some people actually refer to any pharmaceutical pills they can get high off as "Flats" if they have a flat surface. Though some people refer to Xanax pills as flats, majority of people talking about flats are talking about ecstasy pills.