Dublin Circuit Criminal Court heard that she was a substitute teacher and he was a fifth-year student at the time.
Judge Martin Nolan described the crimes as "serious", adding that she must face a custodial sentence.
He described her as a young and inexperienced teacher at the time of the offences, adding that her behaviour brought shame and ridicule on herself.
"She abused her position of trust and authority," Judge Nolan added.
The court heard that the substitute teacher was 23 years old when she met the student in a nightclub in 2017, and they continued to communicate through social media.
The woman, who cannot be named to protect the identity of the boy, waited until his 16th birthday before she had sex with him as she believed this was the age of consent.
Sentencing the defendant, Judge Nolan added: "Undoubtedly her behaviour brought shame on herself. It seems almost certain that she has lost her opportunity to teach for a considerable period of time."
Judge Nolan said he could accept that she believed the age of consent to be 16, however he added that she was a teacher at the time and should have known the appropriate age.
He said the mitigating factors in the case were her early pleas to two counts of defilement, the defendant cooperated fully, she made full admissions and had no previous record.
He said that aggravating factors in the case were that she was a teacher of the boy, and that she was in a position of authority and trust.
"Unfortunately she abused her position of trust," he added.
"It is completely unethical and immoral for a teacher to have these sexual relations with a student.
"It became criminal when the student she had sex with was under the age of consent.
"These are the bare bones of this case."
He said the real question was whether the defendant deserved an immediate custodial sentence, adding that it was the view of the court that she did.
"She was a young and inexperienced teacher at the time," he said.
He said that the reports stated it was unlikely she would offend again.
Judge Nolan added that he considered supervision of the probation services after she is released, however he said it is not appropriate as he does not believe she will reoffend.
The defendant, who wept throughout the hearing, was sentenced to three years in prison, with the final two suspended on the condition that she keep the peace and be of good behaviour.