@OP; do you have any doc about the alarm with the car?
keys can be re-programmed to work, this is written in the alarm manual
the antenna is integrated in the ring around the ignition key house. now i really don't know if this is your issue as i have no experience with Subaru. when i had my Sorento there were some bad antenna batches causing these problems you describe and replacing them sorted it.
if needed i can scan my alarm manual so you can try to re-program both keys but you WILL need the code what the alarm installer worte on a piece of paper.
what about the batteries of both keys?