Under normal circumstances, the notice period will not apply during the probation period unless otherwise specified in the contract of employment. Moreover, no employee shall be compelled to work with an organization. Therefore, there is no legal issue.
However, if you have not disclosed the 4 or 5 months' service to the present organization and later they come to know that there was a concealment of facts, the present employer shall initiate action against you. In such a situation, it is always fair if during the interview you reveal that you are working with an organization and would like to leave it because the job that you are doing is not the one you expected, the work culture does not match your expectations, or due to other reasons. Anyway, the previous company will not proceed much legally because it will not be maintainable.