As The Merriam Dictionary says it means to to get into trouble because of failing to do what is required by (the law, a rule, etc.) For example:
After leaving school she fell foul of the law and spent time in jail.
I have been trying to find something on its origin on the internet, but I cannot find anything. To me as a non-native english speaker the phrase sounds so odd that I am desperate to find out its origin.
Best Answer
According to An Etymological Dictionary of Modern English the expression has a nautical origin meaning become entangled.
and the AHD lists the following meanings:
fall foul/afoul:
From the following sense of foul:
(Etymonline)