No, "learn by hard" is not a stock phrase in English, and it's not clear to native speakers what is meant.
I believe most who hear this will assume that either they misheard or the speaker misspoke, and that the intended phrase was "learn by heart". Depending on a speaker's accent and tone of voice and the listener's ear, 'hard' and 'heart' may sound extremely similar. 'Heart' is generally pronounced more like 'hart', and a 't' and a 'd' may be difficult to discern at the end of a word.
A Google search for the phrase "learn by hard" finds a few places where someone asks if this is a phrase and are told that "learn by heart" is meant, and a few other hits where it is part of a larger expression, such as "learn by hard work" or "learn by hard experience".
I would assume that either you misheard, or that someone is guilty of a typo.