ANSWER: You did not mention which Bible teacher taught this, or which version of Scripture he was using. Nevertheless, the scriptures you gave indicates biblical illiteracy, and possibly his desire to terrify unwed parents.
There are only three instances of the word "bastard" in the word of God.
2 No one born out of wedlock (the KJV uses the term "bastard") or any descendant of such a person . . . may be included among the Lord’s people (Deuteronomy 23:2)
A mixed race (the KJV has 'bastard') shall settle in Ashdod . . . (Zechariah 9:6)
8 If you are not punished . . . it means you are not real children, but bastards. (Hebrews 12:8)
In the Old Testament, a person was a bastard if their mother was a non-Israelite (heathen) regardless of whether their father was an Israelite or not.
Easton's Bible Dictionary defines the Biblical term "bastard" as being synonymous with the word "polluted." In Deuteronomy 23 the term is used to simply mean offspring that are illegitimate. In the book of Zechariah it is used as another reference for a foreigner. Finally, Paul's use of the word in Hebrews 8 was meant to convey the idea of a group of people who don't share in the same privileges as those who are converted.
In your question sent to BibleStudy.org you also referenced the book of Judges in regard to a leader born out of wedlock.
1. Now Jephthah, the Gileadite, was a mighty man of war. And he was the son of a harlot. And Gilead begat Jephthah. 2. And Gilead's wife bore him sons. And his wife's sons grew up, and they threw Jephthah out and said to him, "You shall not inherit in our father's house, for you are the son of another woman" (Judges 11:1 - 3, HBFV)
What happened in Judges 11 was not God's doing. Gilead fathered Jephthah by a harlot, as well as sons by his wife. When they grew up they chased Jephthah out of town because he was "the son of a strange woman" (verse 2). If you read the rest of the story you'll find their fortunes changed, and they called Jephthah back home to be their leader.
Our Creator is, without a doubt, no respecter of persons. The apostle Peter, a Jew, was speaking to a group of gentiles when he said that God does not respect one person over another but rather accepts anyone who is willing to listen to Him and do his will (Acts 10:34 - 35).
Gentiles, of course, have no choice as to who their parents are and neither does an illegitimate (born without the benefit of their parents being married) child. The apostle Peter, however, reminds us that if ANYONE, regardless of how they came into the world, fears God and does what is right, that they will be accepted. The nature of a person's birth has nothing whatsoever to do with whether or not they are ultimately saved. Being born out of wedlock does not matter, what really makes a difference is whether a person has a close and intimate relationship with our Father in heaven.