DMX went to visit his family ... and he could go to jail as a result.

The rapper is out on bail in his tax evasion case, and one of the conditions was that he must give the judge a heads-up if he blows out of town. He left New York to see family in St. Louis, without telling hizzoner ... and that could be a deal breaker.

DMX's attorney, Murray Richman, tells TMZ ... it seems like X just forgot, because he was preoccupied with the trip.

Richman says X usually notifies his probation officer if he's leaving New York to perform, so this is unlike him. He's guessing the judge will show a little mercy and just up the restrictions -- like requiring an ankle bracelet -- but Richman vows to fight it.

Nicholas Biase, a spokesman for the  US attorney for the southern district of NY, tells us X is set to appear in court later this week. 

We broke the story ... DMX is facing 14 counts of evading more than $1 mil in federal taxes.