It depends on the visa. If a foreigner comes here for the purpose of flight training they must go through a part 141 program. If they are here for some other purpose and want to do flight training in addition to their primary reason for being here they can go through a part 61 program.