Both novels were written in Spanish, not Tagalog. He chose Spanish because it was the language of the ruling class and the educated elite in the Philippines at that time. He wanted his message to reach the widest possible audience, including the Spanish authorities.
However, Rizal did write other works in Tagalog, including "A La Juventud Filipina" (To the Filipino Youth) and some poems. He was aware of the importance of the national language, but he believed that using Spanish would give his message greater impact.