Yes, the police can record without prior knowledge. Statements that are made would be admissible if relevant to the case. Generally, the only time that statements are excluded as unlawfully obtained is when they are obtained under threat, if the suspect has been arrested and has not properly been advised of his miranda warnings.
Miranda would be inapplicable here assuming that you were not detained at the time.
You should really speak with an attorney on the matter.
The recording may be admissible even though you had no idea they were making it. This will be true as long as it pertains to the subject of the arrest. This does not mean that there are not other legal ways to exclude the recording (entrapment, duress, etc.)
I would recommend that you seek out and hire and experienced attorney if you have the means to do so. It would be very unfortunate if you were convicted of this crime and received a criminal record for your first ever offense.
Best of luck.